:root {
  color-scheme: light;
  font-family: Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: #17312b;
  background: #eff3ed;
  --surface: #fff;
  --border: #d7e2da;
  --muted: #4e665d;
  --green: #145f4b;
  --green-dark: #12352e;
  --accent: #abedcb;
  --soft: #edf6ef;
  --red: #a42e35;
  --shadow: 0 4px 20px #19382a0a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-block: 5.5rem 5rem; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .66; }
:focus-visible { outline: 3px solid #ca861e; outline-offset: 3px; }
.shell { width: min(100% - 2rem, 74rem); margin-inline: auto; }
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 3;
  padding-top: env(safe-area-inset-top);
  background: var(--green-dark);
  color: #f3fbf5;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  min-height: 4.7rem;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}
.brand img { display: block; }
.brand small {
  display: block;
  color: #bddecd;
  font-size: .71rem;
  font-weight: 400;
}
.app-nav {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-inline: auto;
}
.app-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 2.8rem;
  padding: .3rem .8rem;
  border-radius: .65rem;
  background: #ffffff10;
  text-decoration: none;
  font-size: .82rem;
}
.app-nav a:is(:hover, :focus-visible) { background: #ffffff25; }
.header-connection,
.preview-indicator,
.signal {
  display: flex;
  align-items: center;
  gap: .45rem;
}
.header-connection {
  width: max-content;
  max-width: 55%;
  flex-shrink: 0;
  padding: .24rem .65rem;
  border: 1px solid #588071;
  border-radius: 1rem;
  color: #e2efe6;
  font-size: .73rem;
}
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: #e4b96a; flex: none; }
.header-connection[data-state="recorded"] .dot { background: var(--accent); }
main { padding-block: 1.8rem 2.4rem; }
h1, h2, h3, p, dl { margin: 0; }
h1 { font-size: clamp(1.62rem, 4.8vw, 2.75rem); line-height: 1.35; }
h2 { font-size: 1.08rem; line-height: 1.55; }
h3 { font-size: .94rem; }
p { overflow-wrap: anywhere; }
.fine { color: var(--muted); font-size: .83rem; }
.card {
  min-width: 0;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card-heading { display: flex; align-items: center; gap: .7rem; }
.card-heading > div { min-width: 0; }
.mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: .75rem;
  background: #e7f4eb;
  color: var(--green);
}
.icon { display: inline-block; position: relative; width: 1.25rem; height: 1.25rem; flex: none; }
.icon::before, .icon::after { position: absolute; content: ""; }
.icon-camera::before {
  left: 0;
  top: .25em;
  width: .76em;
  height: .56em;
  border: 1.5px solid currentColor;
  border-radius: .14em;
}
.icon-camera::after {
  right: 0;
  top: .36em;
  border: solid currentColor;
  border-width: 1.5px 1.5px 0 0;
  width: .34em;
  height: .34em;
  transform: rotate(45deg);
}
.icon-device::before { inset: .02em .2em; border: 1.5px solid currentColor; border-radius: .17em; }
.icon-device::after { inset: .22em .46em auto; height: .22em; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-bell::before {
  inset: .12em .22em .25em;
  border: 1.5px solid currentColor;
  border-radius: .54em .54em .13em .13em;
}
.icon-bell::after { inset: auto .52em .04em; height: .13em; border-radius: 50%; background: currentColor; }
.icon-people::before {
  inset: .08em .4em auto;
  height: .37em;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.icon-people::after { inset: .65em .1em .02em; border: 1.5px solid currentColor; border-radius: .5em .5em .13em .13em; }
.dashboard-intro { margin-bottom: 1.15rem; }
.dashboard-intro .fine { margin-top: .3rem; }
.dashboard-grid {
  display: grid;
  gap: .9rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.view-area, .control-area { display: grid; min-width: 0; gap: .85rem; }
.ring-card { margin-bottom: .9rem; border-color: #d7ab59; background: #fffae9; }
.ring-card .mark { background: #fae9bc; color: #724e10; }
.ring-card #ring-text { color: #614e2e; font-size: .86rem; }
.view-card {
  border-color: #265448;
  background: #173a32;
  color: #f6fbf7;
  padding: 0;
  overflow: hidden;
}
.view-card .fine { color: #d0e1d7; }
.view-card .mark { color: var(--accent); background: #386456; }
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .9rem 1rem;
}
#preview-description { color: #c5ded0; font-size: .77rem; }
.preview-indicator {
  min-width: max-content;
  padding: .15rem .55rem;
  border: 1px solid #668b7a;
  border-radius: 1rem;
  color: #e5f3e8;
  font-size: .72rem;
}
.view-card[data-view="live"] .dot { background: #77e6a6; }
.view-card[data-view="idle"] .dot { background: #a7c7b8; }
.viewport {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 11.2rem;
  aspect-ratio: 16 / 9;
  background: #102822;
  border-block: 1px solid #466958;
}
.viewport-empty {
  display: grid;
  place-items: center;
  gap: .75rem;
  color: #ccdfd2;
  font-size: .85rem;
  padding: 1rem;
  text-align: center;
}
.focus-mark {
  display: grid;
  place-items: center;
  width: 4rem;
  height: 3.3rem;
  color: #b0d7be;
  background:
    linear-gradient(#85a698, #85a698) left top / 11px 2px,
    linear-gradient(#85a698, #85a698) left top / 2px 11px,
    linear-gradient(#85a698, #85a698) right top / 11px 2px,
    linear-gradient(#85a698, #85a698) right top / 2px 11px,
    linear-gradient(#85a698, #85a698) left bottom / 11px 2px,
    linear-gradient(#85a698, #85a698) left bottom / 2px 11px,
    linear-gradient(#85a698, #85a698) right bottom / 11px 2px,
    linear-gradient(#85a698, #85a698) right bottom / 2px 11px;
  background-repeat: no-repeat;
}
.focus-mark .icon { font-size: 1.4rem; width: 1.75rem; height: 1.75rem; }
.live-frame { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: #102822; }
.viewport .live-frame { position: absolute; inset: 0; width: 100%; height: 100%; }
.backup-frame { margin-top: .7rem; border-radius: .65rem; }
.preview-footer {
  display: grid;
  gap: .6rem;
  align-items: center;
  padding: .9rem 1rem;
}
.preview-footer button { min-width: 8.2rem; }
.signal {
  width: fit-content;
  max-width: 100%;
  margin-block: .85rem .55rem;
  padding: .27rem .52rem;
  border-radius: .55rem;
  background: #faf2e1;
  color: #684811;
  font-size: .79rem;
}
.signal[data-verified="true"] { background: #e7f4eb; color: #215c46; }
.signal[data-verified="true"] .dot { background: #32965e; }
.details { margin-block: .55rem .3rem; font-size: .8rem; }
.details div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .1rem .6rem;
  padding-block: .4rem;
  border-top: 1px solid var(--border);
}
dt { color: var(--muted); }
dd { margin: 0; max-width: 100%; overflow-wrap: anywhere; }
.hint { background: #edf5ef; border-radius: .65rem; padding: .6rem .7rem; color: #375b4e; font-size: .81rem; margin-block: .6rem; }
.view-card .hint { background: #2f5a4d; color: #e0efe4; }
.primary, .secondary, .danger, .danger-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.85rem;
  padding: .45rem .7rem;
  border: 1px solid transparent;
  border-radius: .62rem;
  line-height: 1.45;
  font-size: .88rem;
  font-weight: 700;
  text-align: center;
}
.primary { background: var(--green); color: #fff; }
.secondary { background: #f8fbf8; color: #244c3f; border-color: #adcdc0; }
.view-card .primary { background: var(--accent); color: #123a2f; }
.view-card .secondary { background: #2a5448; color: #f3fcf7; border-color: #678e7e; }
.danger { background: var(--red); color: white; }
.danger-outline { background: #fff7f6; color: var(--red); border-color: #e4aaa7; }
.access-card .mark { color: #963a36; background: #f9ece8; }
.spaced { margin-top: .72rem; }
.error, .success { margin-top: .5rem; font-size: .86rem; }
.error { color: var(--red); }
.success { color: #14604b; }
.outcome { margin-top: .45rem; }
.outcome:empty { display: none; }
.notification-actions, .pair-choice, .call-actions { display: grid; gap: .5rem; margin-top: .7rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
label { display: block; margin: .65rem 0 .25rem; font-size: .84rem; }
input {
  width: 100%;
  min-height: 2.85rem;
  border: 1px solid #a9c6b9;
  border-radius: .55rem;
  padding: .45rem .6rem;
  color: #15332b;
  background: #fbfdfb;
}
.onboarding { max-width: 32rem; margin: clamp(.7rem, 7vh, 4rem) auto 0; padding: clamp(1.15rem, 5vw, 2.1rem); }
.onboarding > .mark { margin-bottom: .8rem; }
.onboarding > h1 { font-size: clamp(1.45rem, 5vw, 2rem); margin-bottom: .45rem; }
.onboarding > p + p { margin-top: .65rem; }
.pair-card { margin-top: .85rem; }
.pair-methods { display: grid; gap: .65rem; align-items: start; margin-top: .6rem; }
.pair-method { min-width: 0; padding: .68rem; border: 1px solid var(--border); border-radius: .65rem; }
.qr-video { width: 100%; max-height: 23rem; aspect-ratio: 4 / 3; object-fit: cover; margin-top: .6rem; border-radius: .55rem; background: #102822; }
.pair-fallback { margin-top: .5rem; color: var(--muted); font-size: .83rem; }
summary { cursor: pointer; min-height: 2.75rem; padding-block: .48rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link:focus { z-index: 9; inset: .6rem auto auto .6rem; width: auto; height: auto; padding: .5rem .7rem; clip-path: none; background: white; }
#qr-image:focus-visible + .qr-file { outline: 3px solid #ca861e; outline-offset: 3px; }
.invite-view { margin-top: .75rem; }
.invite-view img { display: block; max-width: 100%; height: auto; margin: auto; padding: .3rem; border: 1px solid var(--border); border-radius: .6rem; background: #fff; }
.guest-list { margin: .45rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .82rem; }
.guest-list li { padding: .5rem 0; border-top: 1px solid var(--border); }
.guest-list .secondary { width: auto; margin-top: .35rem; font-size: .8rem; }
.call-controls { border-top: 1px solid #507564; padding: .85rem 1rem 1rem; }
.call-controls button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.door-unlock { margin-top: .8rem; }
.unlock-track {
  --track-edge: .35rem;
  --handle-size: 2.9rem;
  --slide: 0px;
  position: relative;
  display: grid;
  place-items: center;
  direction: ltr;
  min-height: 3.7rem;
  padding-inline: calc(var(--handle-size) + var(--track-edge) + .25rem);
  border: 1px solid #638778;
  border-radius: 2rem;
  background: #12342b;
  color: #f3fbf5;
  text-align: center;
}
.unlock-instruction { font-size: .77rem; line-height: 1.5; pointer-events: none; }
.unlock-handle {
  position: absolute;
  top: 50%;
  left: var(--track-edge);
  display: grid;
  place-items: center;
  width: var(--handle-size);
  height: var(--handle-size);
  padding: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: #12352e;
  background: var(--accent);
  transform: translate(var(--slide), -50%);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}
.unlock-track[data-dragging="true"] .unlock-handle { cursor: grabbing; }
.padlock { position: relative; width: 19px; height: 22px; pointer-events: none; }
.padlock::before {
  content: "";
  position: absolute;
  top: 0;
  left: 4px;
  width: 11px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 8px 8px 0 0;
  transform-origin: right bottom;
}
.padlock::after { content: ""; position: absolute; inset: 9px 0 0; border-radius: 3px; background: radial-gradient(circle, var(--accent) 0 1px, transparent 1.5px) currentColor; }
.unlock-arrow { position: absolute; right: 1.2rem; width: .58rem; height: .58rem; border: solid #a1c3b4; border-width: 2px 2px 0 0; transform: rotate(45deg); }
.unlock-track:is([data-lock="pending"], [data-lock="confirmed"], [data-lock="simulated"]) .unlock-handle { left: calc(100% - var(--handle-size) - var(--track-edge)); transform: translateY(-50%); opacity: 1; }
.unlock-track:not([data-lock="locked"]) .unlock-arrow { visibility: hidden; }
.unlock-track[data-lock="pending"] .unlock-handle { border-style: dashed; color: var(--accent); background: #2f5a4d; }
.unlock-track[data-lock="simulated"] .unlock-handle { background: #ffe2ac; color: #342412; border-color: #ffe2ac; }
.unlock-track:is([data-lock="confirmed"], [data-lock="simulated"]) .padlock::before { transform: translateY(-3px) rotate(32deg); }
.unlock-fallback { display: block; min-height: 2.75rem; padding: .4rem 0; color: #deede3; background: transparent; border: 0; text-decoration: underline; text-underline-offset: .22em; font-size: .8rem; }
.unlock-confirmation { margin-top: .65rem; padding: .7rem; border: 1px solid #9b865a; border-radius: .6rem; font-size: .86rem; }
.view-card .unlock-action { color: #ffdda2; border-color: #b5a06f; }
dialog {
  width: min(calc(100% - 2rem), 29rem);
  max-height: calc(100% - 2rem);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.2rem;
  background: white;
  color: #17312b;
  box-shadow: 0 18px 50px #112e2848;
}
dialog::backdrop { background: #12352e8a; }
dialog:not([open]) { display: none; }
#remove-impact { margin-top: .45rem; color: var(--muted); font-size: .9rem; }
@media (min-width: 42rem) {
  .dashboard-grid { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1rem; }
  .preview-footer { grid-template-columns: minmax(0,1fr) auto; }
  .pair-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ring-card .notification-actions { max-width: 28rem; }
}
@media (max-width: 41.99rem) {
  .app-nav {
    position: fixed;
    z-index: 4;
    inset: auto 0 0;
    min-height: 3.65rem;
    align-items: stretch;
    justify-content: space-around;
    background: #12352e;
    border-top: 1px solid #477160;
    padding: .35rem .5rem max(.38rem, env(safe-area-inset-bottom));
  }
  .app-nav a { flex: 1; flex-direction: column; gap: .05rem; font-size: .72rem; padding: .2rem; background: transparent; }
  body:has(#dashboard:not([hidden])) { padding-bottom: calc(3.9rem + env(safe-area-inset-bottom)); }
  .topbar { min-height: 4.15rem; gap: .5rem; }
  main { padding-top: 1rem; }
  .card { padding: .95rem; }
  .view-card { padding: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: filter .14s ease; }
  button:enabled:hover { filter: brightness(.94); }
  .unlock-track:not([data-dragging="true"]) .unlock-handle { transition: transform .16s ease-out, left .16s ease-out; }
  .padlock::before { transition: transform .2s ease-out; }
}
