/* Staff dashboard: a reception PC, a tablet or a phone. Logical properties keep the
   Arabic (right-to-left) layout correct. */

/* Header ------------------------------------------------------------------------ */

/* The header stays pinned at the top: keep scrolled-to fields and forms clear of it. */
html {
  scroll-padding-top: calc(76px + env(safe-area-inset-top));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(255 255 255 / 0.96);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  min-height: 60px;
  padding: 0.4rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.biz {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  flex: 1;
}

.biz-logo,
.biz-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex: none;
}

.biz-logo {
  object-fit: cover;
  background: var(--brand-soft);
}

.biz-badge {
  display: grid;
  place-items: center;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
}

.biz-text {
  display: grid;
  min-width: 0;
}

.biz-name {
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.biz-sub {
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: none;
}

.lang-toggle {
  flex: none;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #9aa3b2;
}

.live-live .live-dot {
  background: #12b76a;
  box-shadow: 0 0 0 3px rgb(18 183 106 / 0.18);
}

.live-live {
  color: var(--ok);
}

.nav {
  border-top: 1px solid var(--border);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 0.6rem;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 46px;
  padding: 0 0.8rem;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.nav-link[aria-current="page"] {
  color: var(--brand-text);
  border-bottom-color: var(--brand);
}

/* On phones these words are hidden from sight only: screen readers still announce
   "Sign out", "Change business" and the live status. */
@media (max-width: 640px) {
  .hide-narrow,
  .live span:last-child {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }
}

/* Page -------------------------------------------------------------------------- */

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1rem calc(3rem + env(safe-area-inset-bottom));
  display: grid;
  gap: 1rem;
  outline: none;
}

.page h1:focus,
.sheet h2:focus {
  outline: none;
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.view-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.today-badge {
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-weight: 700;
  font-size: 0.82rem;
}

.back-link {
  margin-inline-start: -0.5rem;
}

.date-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.icon-btn {
  min-width: 48px;
  padding: 0;
}

.date-input {
  width: auto;
  min-width: 11rem;
}

/* Day numbers ---------------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 0.6rem;
  margin: 0;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}

.stat dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.stat dd {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-checked-in dd {
  color: var(--ok);
}

.stat-cancelled dd,
.stat-no-show dd {
  color: var(--danger);
}

.sk-stat {
  height: 68px;
}

/* On phones: the six numbers fit in two short rows, and the date bar stays on one line,
   so the appointments start higher up the screen. */
@media (max-width: 640px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .stat {
    padding: 0.4rem 0.55rem;
  }

  .stat dt {
    font-size: 0.72rem;
    line-height: 1.25;
  }

  .stat dd {
    font-size: 1.2rem;
  }

  .date-bar .date-input {
    flex: 1 1 8rem;
    min-width: 0;
  }
}

/* Provider filter and choices ------------------------------------------------------- */

.pills {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.pills.wrap {
  flex-wrap: wrap;
  overflow: visible;
}

.pill {
  flex: none;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}

.pill[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-text);
}

/* Columns ------------------------------------------------------------------------------ */

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
  align-items: start;
}

.column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.column-head {
  display: grid;
  gap: 0.1rem;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid var(--border);
  background: var(--brand-softer);
}

.column-hours {
  color: var(--muted);
  font-size: 0.82rem;
}

.column-list {
  list-style: none;
  margin: 0;
  padding: 0.6rem;
  display: grid;
  gap: 0.5rem;
}

.column-empty {
  padding: 1.2rem 0.95rem;
  color: var(--muted);
  text-align: center;
}

.sk-column {
  height: 240px;
}

.appt-card,
.block-card {
  width: 100%;
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--brand);
  border-radius: 12px;
  background: var(--surface);
  text-align: start;
  font: inherit;
  color: inherit;
}

button.appt-card,
button.block-card {
  cursor: pointer;
}

button.appt-card:hover,
button.block-card:hover {
  border-color: var(--brand);
}

.appt-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
}

.appt-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.appt-meta {
  color: var(--muted);
  font-size: 0.875rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.status-pill,
.source-tag {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-pill {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.status-pill.status-checked_in {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-pill.status-completed {
  background: #eef0f3;
  color: #344054;
}

.status-pill.status-cancelled,
.status-pill.status-no_show {
  background: var(--danger-soft);
  color: var(--danger);
}

.source-tag {
  background: #f2f4f7;
  color: #475467;
}

.source-tag.source-online {
  background: var(--info-soft);
  color: var(--info);
}

.appt-card.status-checked_in {
  border-inline-start-color: var(--ok);
}

.appt-card.status-completed {
  border-inline-start-color: #98a2b3;
}

.appt-card.status-cancelled,
.appt-card.status-no_show {
  border-inline-start-color: var(--danger);
  background: #fcfcfd;
}

.appt-card.status-cancelled .appt-name,
.appt-card.status-cancelled .appt-time {
  text-decoration: line-through;
  color: var(--muted);
}

.appt-card.status-held {
  border-style: dashed;
  border-inline-start-style: solid;
  border-inline-start-color: #98a2b3;
  background: #fafafa;
}

.block-card {
  border-inline-start-color: #667085;
  background: repeating-linear-gradient(135deg, #f2f4f7, #f2f4f7 8px, #e9ecf1 8px, #e9ecf1 16px);
}

/* Details panel ------------------------------------------------------------------------- */

.sheet {
  width: min(520px, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 2rem);
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 48px rgb(16 24 40 / 0.22);
  color: var(--ink);
  overflow-y: auto;
}

.sheet[open] {
  display: grid;
  gap: 1rem;
}

.sheet::backdrop {
  background: rgb(16 24 40 / 0.45);
}

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

.sheet-head h2 {
  font-size: 1.2rem;
}

.details {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.details > div {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.75rem;
}

.details dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.details dd {
  margin: 0;
  font-weight: 500;
}

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

.panel {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid #f8d0cc;
}

.textarea {
  min-height: 84px;
  padding: 0.6rem 0.9rem;
  resize: vertical;
  line-height: 1.45;
}

.notes-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.saved {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--ok);
  font-weight: 600;
}

/* Forms ----------------------------------------------------------------------------------- */

.form-card {
  display: grid;
  gap: 1.1rem;
  max-width: 760px;
}

.form {
  display: grid;
  gap: 1rem;
}

.section {
  display: grid;
  gap: 0.6rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-height: 54px;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  text-align: start;
  cursor: pointer;
}

.chip-name {
  font-weight: 600;
}

.chip-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.chip[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.times-group {
  display: grid;
  gap: 0.5rem;
}

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

.times {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 0.5rem;
}

.time {
  display: grid;
  align-content: center;
  min-height: 48px;
  padding: 0.25rem;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.time-sub {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}

.time[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.time[aria-pressed="true"] .time-sub {
  color: var(--brand-ink);
}

.sk-time {
  height: 48px;
}

.phone-group {
  display: flex;
  direction: ltr;
}

.phone-prefix {
  display: grid;
  place-items: center;
  padding: 0 0.8rem;
  border: 1px solid var(--border-strong);
  border-inline-end: 0;
  border-radius: 10px 0 0 10px;
  background: #f2f4f7;
  font-weight: 600;
  color: var(--muted);
}

.phone-group .input {
  border-radius: 0 10px 10px 0;
}

.radios {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.radios legend {
  width: 100%;
  margin-bottom: 0.35rem;
}

.radio,
.check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  cursor: pointer;
  font-weight: 500;
}

.radio input,
.check input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--brand);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

/* A field with a hint next to one without: keep both inputs on the same line. */
.field-row > .field {
  align-content: start;
}

.input:disabled {
  background: #f2f4f7;
  color: var(--muted);
}

/* Reminders ---------------------------------------------------------------------------------- */

.count {
  font-weight: 600;
  color: var(--muted);
}

.rem-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
  max-width: 860px;
}

.rem-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
}

.rem-row.is-sent {
  background: #fbfefc;
  border-color: #b8e6cc;
}

.rem-info {
  display: grid;
  gap: 0.1rem;
}

.rem-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rem-name {
  font-weight: 600;
}

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

.sent-mark {
  color: var(--ok);
  font-weight: 700;
  font-size: 0.9rem;
}

.tip {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  max-width: 860px;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 0.4rem;
  padding: 1.4rem 1rem;
  text-align: center;
  color: var(--muted);
}

.empty .icon {
  width: 28px;
  height: 28px;
}

/* Sign-in screens ------------------------------------------------------------------------------ */

.page-auth {
  max-width: 480px;
  padding-top: 2.5rem;
}

.auth-card {
  display: grid;
  gap: 1.1rem;
}

.auth-head {
  display: grid;
  gap: 0.35rem;
}

.signed-in-as {
  font-weight: 600;
}

.options {
  display: grid;
  gap: 0.55rem;
}

.option {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  min-height: 64px;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  text-align: start;
  cursor: pointer;
}

.option:hover,
.option[aria-current="true"] {
  border-color: var(--brand);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-weight: 700;
}

.option-text {
  display: grid;
  flex: 1;
  min-width: 0;
}

.option-title {
  font-weight: 600;
}

.option-sub {
  color: var(--muted);
  font-size: 0.875rem;
}

.option-go {
  color: var(--muted);
}

.sk-title {
  height: 2rem;
  width: 60%;
}

/* Settings and owner console ----------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.tab[aria-current="page"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.settings-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.row-main {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  flex: 1 1 14rem;
}

.row-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.row-sub {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

a.row-sub {
  color: var(--brand-text);
  justify-self: start;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.row-panel {
  flex: 1 1 100%;
  display: grid;
  gap: 0.75rem;
}

.btn-small {
  min-height: 40px;
  padding: 0 0.8rem;
  font-size: 0.9rem;
}

.danger-text {
  color: var(--danger);
}

.source-tag.tag-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.sk-row {
  height: 64px;
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.feature-list .icon {
  color: var(--ok);
}

.logo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.logo-preview {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border: 1px solid var(--border);
  object-fit: contain;
  background: var(--surface);
}

.logo-empty {
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 1.6rem;
  font-weight: 700;
}

/* The file picker is reached with the keyboard; its label is the visible button. */
.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.file-input:focus-visible + label {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.file-input:disabled + label {
  opacity: 0.6;
  pointer-events: none;
}

label.btn {
  cursor: pointer;
}

.link-box {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: var(--brand-softer);
  border: 1px solid var(--border);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.color-input {
  width: 5rem;
  padding: 0.25rem;
  cursor: pointer;
}

.input-short {
  max-width: 10rem;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.checks legend {
  width: 100%;
  margin-bottom: 0.25rem;
}

.week {
  display: grid;
  gap: 0.5rem;
}

.day-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  align-items: start;
  gap: 0.5rem 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
}

.day-name {
  font-weight: 700;
}

.shifts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
}

.shift {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.time-input {
  width: 8.2rem;
  padding: 0 0.5rem;
}

.closed {
  align-self: center;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.shifts .field-error {
  flex-basis: 100%;
}

@media (max-width: 640px) {
  .day-row {
    grid-template-columns: 1fr;
  }

  .time-input {
    width: 7.4rem;
  }

  .row-actions {
    flex: 1 1 100%;
  }
}
