:root {
  color-scheme: light dark;
  --bg: light-dark(#f3efe7, #141311);
  --surface: light-dark(#fffcf7, #1c1b18);
  --text: light-dark(#1b1814, #f4efe6);
  --muted: light-dark(#6f685e, #a8a197);
  --accent: light-dark(#1a6b48, #3ecf7a);
  --accent-text: light-dark(#ffffff, #062012);
  --danger: light-dark(#b42318, #ff7a6e);
  --line: light-dark(#e6dfd4, #2c2a26);
  --dot-on: #2f9e5e;
  --dot-off: #c44536;
  --dot-work-a: #2563eb;
  --dot-work-b: #22c55e;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 12px 32px rgb(0 0 0 / 0.06);
  --font: ui-monospace, "Cascadia Code", "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
}

#app {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
}

.chrome {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 0.65rem;
  row-gap: 0.1rem;
  align-items: center;
  flex-shrink: 0;
  padding: calc(0.45rem + env(safe-area-inset-top, 0px)) 1rem 0.45rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  grid-column: 1;
  grid-row: 1 / span 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.brand-mark {
  width: 2.85rem;
  height: 2.85rem;
  flex: 0 0 auto;
  display: block;
  background: currentColor;
  -webkit-mask: url("/static/office/hound.svg") center / contain no-repeat;
  mask: url("/static/office/hound.svg") center / contain no-repeat;
}

.brand-sep {
  width: 1px;
  height: 1.15rem;
  background: var(--line);
  flex: 0 0 auto;
}

.brand-name {
  font-weight: 650;
  letter-spacing: 0.02em;
}

.chrome-center {
  min-width: 0;
  text-align: center;
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chrome-mode {
  grid-column: 2;
  grid-row: 1;
}

.chrome-company {
  grid-column: 2;
  grid-row: 2;
  min-height: 1.2em;
  font-weight: 500;
  color: var(--muted);
}

.chrome-right {
  grid-column: 3;
  grid-row: 1 / span 2;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.debug-bar {
  flex-shrink: 0;
  padding: 0.2rem 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: #fff;
  background: light-dark(#e56b4e, #ff7a5c);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-bar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.5rem;
  min-height: 2.4rem;
  padding: 0 1rem;
}

.action-bar-left,
.action-bar-center,
.action-bar-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.4rem;
}

.action-bar-left {
  justify-self: start;
}

.action-bar-center {
  justify-self: center;
}

.action-bar-right {
  justify-self: end;
}

.action-bar .action-add {
  width: 2.35rem;
  height: 2.35rem;
  color: var(--text);
}

.action-bar .action-add svg,
.action-bar .icon-btn svg {
  width: 1.45rem;
  height: 1.45rem;
}

.action-bar .icon-btn {
  width: 2.35rem;
  height: 2.35rem;
  color: var(--text);
}

.chrome-avatar {
  width: 2.85rem;
  height: 2.85rem;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: inherit;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  border: 1px solid var(--line);
}

.chrome-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.menu-btn {
  font: inherit;
  background: transparent;
  color: inherit;
  border: none;
  border-radius: 8px;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
}

.menu-btn:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  color: inherit;
}

.icon-hamburger {
  width: 2.5rem;
  height: 2.5rem;
  display: block;
  background: currentColor;
  -webkit-mask: url("/static/office/hamburger-menu.svg") center / contain no-repeat;
  mask: url("/static/office/hamburger-menu.svg") center / contain no-repeat;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.4);
  display: grid;
  place-items: start stretch;
  z-index: 20;
}

.menu-panel {
  margin: 0;
  width: min(22rem, calc(100% - 1.5rem));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
}

.menu-who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem 0.65rem;
}

.menu-who-name {
  min-width: 0;
  font-weight: 550;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-who .chrome-avatar {
  width: 2.4rem;
  height: 2.4rem;
  font-size: 0.85rem;
}

.menu-rule {
  height: 0;
  margin: 0.1rem 0.55rem 0.25rem;
  border: 0;
  border-top: 1px solid var(--line);
}

.menu-overlay-wide {
  background: transparent;
}

.menu-overlay-wide .menu-panel {
  margin: 0;
  position: fixed;
}

.menu-item {
  font: inherit;
  text-align: left;
  background: transparent;
  color: inherit;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
}

.menu-item:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.menu-icons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  padding: 0.2rem 0.35rem 0.15rem;
}

.menu-icon {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 0.45rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-icon:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.icon-cog {
  width: 1.45rem;
  height: 1.45rem;
  display: block;
  background: currentColor;
  -webkit-mask: url("/static/office/cog.svg") center / contain no-repeat;
  mask: url("/static/office/cog.svg") center / contain no-repeat;
}

.status-dot {
  flex: 0 0 auto;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--dot-off);
  box-shadow: 0 0 0 3px rgb(196 69 54 / 0.15);
}

.status-dot.is-online {
  background: var(--dot-on);
  box-shadow: 0 0 0 3px rgb(47 158 94 / 0.18);
}

.status-dot.is-working {
  animation: status-working 0.16s steps(2, end) infinite;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.2);
}

@keyframes status-working {
  0% { background: var(--dot-work-a); }
  100% { background: var(--dot-work-b); }
}

.screen {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  overflow: auto;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  align-content: start;
}

.screen-cards {
  place-items: start stretch;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  width: 100%;
  align-content: start;
}

.card {
  position: relative;
  width: min(28rem, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.4rem 1.35rem;
}

.card:has(.card-trash) {
  padding-right: 2.6rem;
}

.card:has(.card-actions) {
  padding-right: 2.6rem;
}

.card:has(.card-actions .icon-danger) {
  padding-right: 4.6rem;
}

.card-grid .card {
  position: relative;
  width: auto;
  min-height: 9rem;
  margin: 0;
  cursor: pointer;
}

.card-grid .card:not(.card-blank) {
  padding-right: 2.6rem;
}

.card-trash {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
}

.card-actions {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.05rem;
}

.card-person {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.1rem 0 0.45rem;
  margin: 0;
  cursor: pointer;
}

.screen-list {
  place-items: start stretch;
  padding: 1rem 1.25rem 2rem;
}

.list {
  width: min(52rem, 100%);
  justify-self: stretch;
}

.list-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.seg .btn {
  border: 0;
  border-radius: 0;
}

.seg .is-on,
.btn.is-on {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
  font-weight: 600;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.78rem;
  line-height: 1;
}

.choice-opt {
  display: inline-flex;
  align-items: center;
  font: inherit;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0.35rem 0.1rem;
  min-height: 2rem;
  cursor: pointer;
}

.choice-opt svg {
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.18em;
  flex: 0 0 auto;
}

.choice-opt.is-on {
  color: var(--accent);
  font-weight: 650;
}

.choice-opt.is-on::before {
  content: "[";
  margin-right: 0.12em;
  font-weight: 400;
}

.choice-opt.is-on::after {
  content: "]";
  margin-left: 0.12em;
  font-weight: 400;
}

.action-bar .choice {
  font-size: 0.7rem;
  gap: 0.55rem;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.35rem 0;
}

.card-wide {
  width: min(40rem, 100%);
}

.card-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(40rem, 100%);
}

.card-rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.35rem 0 0.15rem;
}

.customer-place-facts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.card:has(.customer-map) {
  padding-right: 11rem;
}

.customer-map {
  position: absolute;
  right: 1.4rem;
  bottom: 1.35rem;
  width: 9rem;
  height: 9rem;
  border-radius: 0.65rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg);
}

.customer-map-tiles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.customer-map-tile {
  position: absolute;
  width: 16rem;
  height: 16rem;
  max-width: none;
  display: block;
}

.customer-map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 0.85rem;
  height: 0.85rem;
  margin: -0.85rem 0 0 -0.425rem;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.35);
  pointer-events: none;
}

.customer-map-copy {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 1;
  font-size: 0.55rem;
  line-height: 1;
  padding: 0.15rem 0.28rem;
  background: rgb(255 255 255 / 0.78);
  color: #333;
  text-decoration: none;
  border-top-left-radius: 0.25rem;
}

.event-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.85rem 0 0.35rem;
  border-top: 1px solid var(--line);
}

.event-block h2 {
  margin: 0;
  font-size: 1.05rem;
}

.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.list-row:hover {
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.list-main {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}

.list-name {
  font-weight: 550;
}

.list-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.list-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.icon-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0.35rem;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.icon-btn.card-trash:hover,
.icon-btn.icon-danger:hover {
  color: var(--danger);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.icon-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  fill: currentColor;
}

.dashboard {
  place-items: start;
  padding: 1.5rem 1.75rem 2rem;
}

.dashboard h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.account .card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.fact-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.fact-value {
  font-weight: 550;
}

.card-blank {
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: none;
  border-style: dashed;
  color: var(--muted);
  font-size: 2.25rem;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
}

.card-blank:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.card h1, .card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.muted {
  color: var(--muted);
  margin: 0 0 1.15rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-size: 0.85rem;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}

.field textarea {
  min-height: 4.5rem;
  resize: vertical;
}

.profile-pic {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1.15rem;
}

.profile-pic-frame {
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  border: 1px solid var(--line);
}

.profile-pic-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-pic-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.section-label {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  font-weight: 550;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.section-head .section-label {
  margin: 0;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  padding: calc(1rem + env(safe-area-inset-top, 0px)) 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  background: rgb(0 0 0 / 0.55);
}

.popup-card {
  width: min(28rem, 92vw);
  max-height: min(80dvh, 40rem);
  overflow: auto;
  margin: 0;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(0.75rem + env(safe-area-inset-top, 0px)) 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  background: rgb(0 0 0 / 0.82);
  color: #f4efe6;
}

.camera-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
}

.camera-bar .seg {
  border-color: rgb(255 255 255 / 0.2);
}

.camera-bar .btn {
  color: inherit;
  background: rgb(255 255 255 / 0.08);
  border-color: rgb(255 255 255 / 0.18);
}

.camera-bar .btn.is-on,
.camera-bar .seg .is-on {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
}

.camera-stage {
  position: relative;
  width: min(92vw, 28rem);
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
  flex: 0 0 auto;
  box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.45);
}

.camera-stage-square {
  aspect-ratio: 1;
}

.camera-stage-rect {
  aspect-ratio: 4 / 3;
}

.camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.camera-shutter {
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #fff;
  box-shadow: 0 0 0 4px rgb(0 0 0 / 0.35);
  cursor: pointer;
  flex: 0 0 auto;
}

.camera-shutter:hover {
  background: #eee;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-color: var(--accent);
}

.row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-text);
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.error {
  color: var(--danger);
  margin: 0;
  font-size: 0.92rem;
}

.form > .error {
  margin: 0 0 0.75rem;
}

.layout-mobile-tall .screen,
.layout-mobile-wide .screen {
  place-items: start center;
  padding: 1rem;
}
