/* Shared visual refinements for the public site and authenticated workspaces. */
:root {
  --ui-teal: #009f95;
  --ui-teal-dark: #087a74;
  --ui-purple: #642397;
  --ui-blue: #1769aa;
  --ui-danger: #c2413a;
  --ui-warning: #c56a08;
  --ui-ink: #172033;
  --ui-muted: #667085;
  --ui-line: #dce6ec;
  --ui-shadow-sm: 0 8px 24px rgba(15, 77, 125, .07);
  --ui-shadow-md: 0 18px 44px rgba(15, 77, 125, .10);
  --ui-control-height: 44px;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(23, 105, 170, .22);
  outline-offset: 2px;
}

.public-shell {
  position: relative;
}

/* Public header: brand remains on the RTL leading edge. */
.public-header {
  min-height: 72px;
  padding-block: 8px;
  padding-inline: max(16px, calc((100vw - 1180px) / 2));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  direction: rtl;
}

.public-header .brand {
  order: 0;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  width: 100%;
  max-width: 100%;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  direction: rtl;
  text-align: right;
  overflow: hidden;
}

.public-header .brand > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.public-header .sahm-logo-img.compact {
  width: clamp(50px, 4.5vw, 62px);
  height: clamp(50px, 4.5vw, 62px);
  max-height: none;
  object-fit: contain;
  flex: 0 0 auto;
}

.public-header .brand strong {
  color: var(--ui-ink);
  font-size: clamp(14px, 1.3vw, 18px);
  line-height: 1.35;
  font-weight: 900;
}

.public-header .brand span {
  color: var(--ui-muted);
  font-size: clamp(11px, 1vw, 13px);
  line-height: 1.4;
  font-weight: 700;
}

.public-header-actions {
  order: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  justify-self: start;
  gap: 9px;
  direction: ltr;
}

.public-contact,
.language-toggle {
  min-height: 42px;
}

.public-contact {
  padding-inline: 20px;
  box-shadow: 0 10px 24px rgba(100, 35, 151, .15);
}

.language-toggle {
  min-width: 42px;
  border-radius: 50%;
}

/* Public cards and form controls. */
.public-mode .intro > div,
.public-mode .form-card,
.hullah-affiliation,
.license-card,
.metric-tile,
.thank-card,
.login-card {
  border-color: rgba(0, 159, 149, .14);
}

.public-mode .intro > div,
.public-mode .form-card,
.hullah-affiliation,
.license-card {
  box-shadow: var(--ui-shadow-md);
}

.public-mode .form-card,
.thank-card,
.login-card {
  overflow: hidden;
}

.public-mode .form-card .card-head,
.thank-card .card-head,
.login-card .card-head,
.public-mode .form-card .form-body,
.thank-card .form-body,
.login-card .form-body {
  padding: clamp(20px, 3vw, 28px);
}

.public-mode .form-card .form-body,
.thank-card .form-body,
.login-card .form-body {
  gap: 16px;
}

.public-mode .field label,
.login-screen .field label {
  margin-bottom: 7px;
  color: #263244;
  font-weight: 850;
}

.public-mode .field input,
.public-mode .field select,
.public-mode .field textarea,
.login-screen .field input,
.login-screen .field select,
.login-screen .field textarea,
.city-choice button {
  min-height: 48px;
  border-radius: 8px;
  border-color: var(--ui-line);
  background: #fff;
}

.public-mode .field input:hover,
.public-mode .field select:hover,
.public-mode .field textarea:hover,
.login-screen .field input:hover,
.login-screen .field select:hover,
.login-screen .field textarea:hover {
  border-color: #b9d8d5;
}

.public-mode .field input:focus,
.public-mode .field select:focus,
.public-mode .field textarea:focus,
.login-screen .field input:focus,
.login-screen .field select:focus,
.login-screen .field textarea:focus {
  border-color: var(--ui-teal);
  box-shadow: 0 0 0 4px rgba(0, 159, 149, .11);
}

.public-pickup-date-field {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(0, 159, 149, .14);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0, 159, 149, .055), rgba(100, 35, 151, .035));
}

.public-pickup-date-field .field-optional {
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 700;
}

.public-pickup-date-field input[type="date"] {
  width: 100%;
  min-height: 50px;
  color: #172033;
  font: inherit;
  cursor: pointer;
  direction: ltr;
  text-align: right;
  unicode-bidi: isolate;
}

.public-date-control {
  position: relative;
  width: 100%;
  min-width: 0;
  direction: rtl;
}

.public-date-control input[type="date"] {
  padding-right: 48px;
  padding-left: 14px;
}

.public-date-control input[type="date"]:not(.has-value) {
  color: transparent;
}

.public-date-control input[type="date"]:not(.has-value)::-webkit-datetime-edit {
  color: transparent;
}

.public-date-format {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 48px;
  inset-inline-end: 14px;
  transform: translateY(-50%);
  color: #667085;
  direction: rtl;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  transition: opacity .15s ease;
}

.public-date-control input[type="date"].has-value + .public-date-format {
  opacity: 0;
}

.public-pickup-date-field input[type="date"]::-webkit-calendar-picker-indicator {
  width: 20px;
  height: 20px;
  cursor: pointer;
  opacity: .72;
}

.public-pickup-date-field small {
  display: block;
  margin-top: 8px;
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.7;
}

.city-choice {
  gap: 10px;
}

.city-choice button {
  font-weight: 850;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.city-choice button:hover {
  border-color: rgba(0, 159, 149, .45);
  background: #f3fbfa;
  transform: translateY(-1px);
}

.city-choice button.active,
.city-choice button[aria-pressed="true"] {
  border-color: var(--ui-teal);
  background: rgba(0, 159, 149, .09);
  color: var(--ui-teal-dark);
}

.metric-tile {
  min-width: 0;
  border-radius: 18px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.metric-tile:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 159, 149, .25);
  box-shadow: 0 18px 40px rgba(15, 77, 125, .11);
}

.hullah-affiliation,
.license-card,
.hullah-copy,
.license-copy,
.license-visual,
.hullah-identity-card {
  min-width: 0;
}

.hullah-feature-list li {
  min-width: 0;
  border-radius: 16px;
}

.license-button {
  min-height: 46px;
  padding-inline: 22px;
}

/* Footer: brand right, contact center, social links left. */
.public-footer {
  position: relative;
  padding-block: clamp(42px, 5vw, 64px) clamp(34px, 4vw, 48px);
  padding-inline: max(20px, calc((100vw - 1180px) / 2));
}

.public-footer-grid {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(240px, 1.05fr) minmax(250px, 1fr) minmax(210px, .85fr);
  align-items: start;
  gap: clamp(28px, 4vw, 56px);
  direction: rtl;
}

.public-footer-grid > section {
  min-width: 0;
}

.public-footer-grid > section:first-child {
  justify-self: end;
  text-align: right;
}

.public-footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  direction: rtl;
  text-align: right;
}

.public-footer-brand > div {
  text-align: right;
}

.public-footer-logo {
  width: clamp(104px, 9vw, 132px);
  height: auto;
  max-height: 132px;
  object-fit: contain;
  align-self: flex-start;
}

.public-footer-grid > section:nth-child(2) {
  justify-self: center;
  text-align: right;
}

.public-footer-grid > section:last-child {
  justify-self: start;
  text-align: left;
  direction: ltr;
  padding-inline-start: 76px;
}

.public-footer-grid > section:last-child h4 {
  text-align: left;
}

.public-socials {
  justify-content: flex-start;
  gap: 10px;
}

.public-socials a,
.public-socials img {
  width: 42px;
  height: 42px;
}

.public-socials a {
  border-radius: 8px;
}

.footer-contact-item {
  min-height: 36px;
  flex-wrap: wrap;
}

.floating-contact {
  left: max(14px, env(safe-area-inset-left));
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 1100px) {
  .public-footer {
    padding-block: 58px 52px;
    padding-inline: clamp(54px, 5vw, 96px);
  }

  .public-footer-grid {
    max-width: 1600px;
    grid-template-columns: minmax(300px, 1fr) minmax(360px, 1.1fr) minmax(300px, 1fr);
    gap: clamp(72px, 7vw, 132px);
  }

  .public-footer-grid > section:first-child {
    width: min(100%, 330px);
  }

  .public-footer-brand {
    gap: 14px;
  }

  .public-footer-logo {
    width: clamp(138px, 8vw, 158px);
    max-height: 158px;
  }

  .public-footer-brand h3 {
    margin-bottom: 6px;
    font-size: 20px;
    line-height: 1.5;
  }

  .public-footer-brand p {
    font-size: 15px;
    line-height: 2;
  }

  .public-footer-grid > section:nth-child(2) {
    width: min(100%, 390px);
  }

  .public-footer-grid > section:nth-child(2) h4,
  .public-footer-grid > section:last-child h4 {
    margin-bottom: 18px;
    font-size: 20px;
  }

  .public-footer-contact {
    gap: 13px;
  }

  .footer-contact-item {
    min-height: 40px;
    gap: 11px;
    font-size: 15px;
    line-height: 1.8;
  }

  .footer-contact-item > svg,
  .footer-contact-item svg {
    width: 21px;
    height: 21px;
  }

  .public-footer a {
    font-size: 15px;
  }

  .footer-copy-phone {
    width: 36px;
    height: 36px;
  }

  .public-footer-grid > section:last-child {
    width: min(100%, 340px);
    padding-inline-start: 70px;
  }

  .public-socials {
    gap: 12px;
  }

  .public-socials a,
  .public-socials img {
    width: 50px;
    height: 50px;
  }
}

/* Shared controls in the operational workspace. */
#adminApp .section,
#adminApp .mini-card,
#adminApp .request-card,
#adminApp .delegate-card,
#adminApp .integration-card,
#adminApp .report-kpi,
#adminApp .metric,
#adminApp .permission-card,
#adminApp .ops-card,
#adminApp .work-center,
#adminApp .period-bar {
  min-width: 0;
  border-color: var(--ui-line);
  box-shadow: var(--ui-shadow-sm);
}

#adminApp .section,
#adminApp .integration-card,
#adminApp .work-center,
#adminApp .period-bar {
  border-radius: 8px;
  overflow: clip;
}

#adminApp .section-head,
#adminApp .toolbar,
#adminApp .actions,
#adminApp .period-actions,
#adminApp .period-meta {
  min-width: 0;
  gap: 9px;
  flex-wrap: wrap;
}

#adminApp .section-head {
  padding: 14px 16px;
  align-items: center;
}

#adminApp .section-head h2,
#adminApp .topbar h1 {
  min-width: 0;
  overflow-wrap: anywhere;
}

#adminApp .section-body {
  min-width: 0;
  padding: 16px;
}

#adminApp .btn,
#adminApp .refresh-btn,
#adminApp .period-chip,
#adminApp .icon-btn,
#adminApp button:not(.sidebar-backdrop) {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 850;
}

#adminApp .btn,
#adminApp .refresh-btn,
#adminApp .period-chip {
  padding-block: 9px;
  padding-inline: 14px;
}

#adminApp .icon-btn {
  width: 42px;
  min-width: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#adminApp .btn.primary {
  background: var(--ui-teal-dark);
  border-color: var(--ui-teal-dark);
  color: #fff;
}

#adminApp .btn.primary:hover {
  background: #066d68;
  border-color: #066d68;
}

#adminApp .btn.warning {
  background: var(--ui-warning);
  border-color: var(--ui-warning);
  color: #fff;
}

#adminApp .btn.danger {
  background: var(--ui-danger);
  border-color: var(--ui-danger);
  color: #fff;
}

#adminApp .field input:not([type="checkbox"]):not([type="radio"]),
#adminApp .field select,
#adminApp .field textarea,
#adminApp input:not([type="checkbox"]):not([type="radio"]),
#adminApp select,
#adminApp textarea {
  width: 100%;
  min-height: var(--ui-control-height);
  border-radius: 8px;
  border-color: var(--ui-line);
  background-color: #fff;
}

#adminApp textarea {
  min-height: 104px;
  resize: vertical;
}

#adminApp .field input:not([type="checkbox"]):not([type="radio"]):focus,
#adminApp .field select:focus,
#adminApp .field textarea:focus,
#adminApp input:not([type="checkbox"]):not([type="radio"]):focus,
#adminApp select:focus,
#adminApp textarea:focus {
  border-color: var(--ui-blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, .12);
}

#adminApp .stats-grid,
#adminApp .compact-grid,
#adminApp .filters,
#adminApp .form-grid,
#adminApp .report-kpi-grid,
#adminApp .report-group-grid,
#adminApp .delegate-summary,
#adminApp .delegate-breakdown,
#adminApp .delegate-review-summary,
#adminApp .delegate-admin-kpis,
#adminApp .delegate-region-grid {
  min-width: 0;
  gap: 12px;
}

#adminApp .topbar,
#adminApp .topbar > *,
#adminApp .main,
#adminApp .content,
#adminApp .view,
#adminApp .detail-grid {
  min-width: 0;
}

#adminApp .topbar {
  gap: 14px;
}

#adminApp .period-bar {
  padding: 12px;
}

#adminApp .period-chip.active {
  background: var(--ui-blue);
  border-color: var(--ui-blue);
  color: #fff;
}

#adminApp .table-wrap,
#adminApp .cloud-review-table {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: #b7c7d6 transparent;
}

#adminApp table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

#adminApp th,
#adminApp td {
  padding-block: 11px;
  padding-inline: 10px;
  vertical-align: middle;
}

#adminApp th {
  white-space: nowrap;
}

#adminApp .mobile-list > *,
#adminApp .request-card,
#adminApp .delegate-card {
  min-width: 0;
}

#adminApp .sidebar .brand {
  min-width: 0;
  align-items: center;
}

#adminApp .sidebar-logo {
  width: 66px;
  height: 66px;
  object-fit: contain;
  flex: 0 0 auto;
}

#adminApp .nav button {
  min-height: 44px;
  border-radius: 8px;
  padding-block: 10px;
  padding-inline: 12px;
}

#adminApp .nav button.active {
  box-shadow: inset -3px 0 0 var(--ui-blue);
}

.login-screen {
  padding: clamp(16px, 4vw, 42px);
}

.login-screen .login-card,
.login-screen .thank-card {
  width: min(540px, 100%);
  margin: auto;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(15, 77, 125, .14);
}

.login-logo {
  width: clamp(92px, 18vw, 126px);
  height: auto;
  object-fit: contain;
}

@media (max-width: 1024px) {
  .public-footer-grid {
    grid-template-columns: minmax(220px, 1fr) minmax(230px, 1fr) minmax(190px, .8fr);
    gap: 28px;
  }

  #adminApp .stats-grid,
  #adminApp .compact-grid,
  #adminApp .report-kpi-grid,
  #adminApp .delegate-summary,
  #adminApp .delegate-review-summary,
  #adminApp .delegate-admin-kpis,
  #adminApp .delegate-region-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .public-header {
    min-height: 66px;
    padding-inline: 12px;
    gap: 8px;
  }

  .public-shell > .public-header .brand {
    width: 100%;
    max-width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    text-align: right;
  }

  .public-shell > .public-header .brand > div {
    text-align: right;
  }

  .public-header .sahm-logo-img.compact {
    width: 48px;
    height: 48px;
  }

  .public-header .brand strong,
  .public-header .brand span {
    max-width: 42vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .public-contact {
    min-width: 88px;
    padding-inline: 12px;
  }

  .hullah-affiliation,
  .license-card {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .hullah-copy,
  .license-copy {
    text-align: right;
  }

  .hullah-identity-card,
  .license-visual {
    width: min(100%, 520px);
    justify-self: center;
  }

  .license-section {
    padding-bottom: calc(148px + env(safe-area-inset-bottom, 0px));
  }

  .public-footer {
    padding: 38px 18px 44px;
  }

  .public-footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .public-footer-grid > section:first-child,
  .public-footer-grid > section:nth-child(2) {
    width: 100%;
    justify-self: end;
    text-align: right;
  }

  .public-footer-grid > section:last-child {
    width: 100%;
    justify-self: start;
    padding-inline-start: 0;
  }

  .public-footer-brand {
    align-items: flex-start;
  }

  .public-shell > .floating-contact {
    --floating-button-size: 52px;
    --floating-button-gap: 10px;
    --floating-footer-gap: 16px;
    position: fixed;
    left: max(12px, env(safe-area-inset-left));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: auto;
    padding: 0;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-start;
    background: transparent;
    z-index: 99999;
  }

  .public-shell > .floating-contact.stop-before-footer {
    position: absolute;
    bottom: calc(var(--floating-footer-height, 0px) + var(--floating-footer-gap));
  }

  #adminApp .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #adminApp .topbar-center {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-self: stretch;
  }
}

@media (max-width: 640px) {
  .public-shell > .public-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-content: stretch;
    direction: rtl;
  }

  .public-shell > .public-header .brand {
    gap: 8px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: right;
    overflow: hidden;
  }

  .public-shell > .public-header .brand strong {
    font-size: 13px;
    text-align: right;
  }

  .public-shell > .public-header .brand span {
    font-size: 10px;
    text-align: right;
  }

  .public-contact {
    min-width: 78px;
    max-width: 96px;
    font-size: 12px;
  }

  .language-toggle {
    min-width: 38px;
    width: 38px;
    min-height: 38px;
    height: 38px;
  }

  .public-mode .public-main,
  .public-stats-section,
  .license-section {
    padding-inline: 12px;
  }

  .hullah-affiliation {
    width: calc(100% - 24px);
    padding: 20px;
    border-radius: 20px;
  }

  .license-card {
    padding: 20px;
    border-radius: 20px;
  }

  .hullah-feature-list li {
    min-height: 52px;
    padding: 11px 13px;
    border-radius: 12px;
    font-size: 13px;
  }

  .intro-metrics {
    grid-template-columns: 1fr;
  }

  .metric-tile {
    min-height: 132px;
    border-radius: 14px;
  }

  #adminApp .content {
    padding-inline: 10px;
  }

  #adminApp .topbar,
  #adminApp .section-head,
  #adminApp .section-body,
  #adminApp .period-bar {
    padding-inline: 12px;
  }

  #adminApp .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  #adminApp .stats-grid,
  #adminApp .compact-grid,
  #adminApp .filters,
  #adminApp .form-grid,
  #adminApp .manual-request-grid,
  #adminApp .report-kpi-grid,
  #adminApp .report-group-grid,
  #adminApp .delegate-summary,
  #adminApp .delegate-breakdown,
  #adminApp .delegate-review-summary,
  #adminApp .delegate-admin-kpis,
  #adminApp .delegate-region-grid {
    grid-template-columns: 1fr;
  }

  #adminApp .btn:not(.link),
  #adminApp .refresh-btn,
  #adminApp .period-chip {
    min-height: 44px;
  }

  #adminApp .section-head .toolbar,
  #adminApp .period-actions,
  #adminApp .period-meta {
    width: 100%;
  }

  #adminApp .period-actions .period-chip {
    flex: 1 1 calc(50% - 8px);
  }

  #adminApp .section-head .toolbar > .btn,
  #adminApp .section-head .toolbar > select {
    flex: 1 1 min(100%, 170px);
  }

  #adminApp .modal-card,
  #adminApp .modal-content,
  #adminApp dialog {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

}

@media (max-width: 420px) {
  .public-header {
    min-height: 62px;
    padding-inline: 10px;
  }

  .public-header .sahm-logo-img.compact {
    width: 44px;
    height: 44px;
  }

  .public-header .brand strong {
    font-size: 12px;
  }

  .public-header .brand span {
    max-width: 34vw;
    font-size: 9px;
  }

  .public-header-actions {
    gap: 5px;
  }

  .public-contact {
    min-width: 72px;
    max-width: 86px;
    padding-inline: 8px;
    font-size: 11px;
  }

  .language-toggle {
    min-width: 36px;
    width: 36px;
    min-height: 36px;
    height: 36px;
  }

  .public-footer {
    padding: 34px 14px 40px;
  }

  .public-footer-logo {
    width: 98px;
    max-height: 98px;
  }

  #adminApp .topbar {
    padding-left: 58px;
  }

  #adminApp .btn,
  #adminApp .refresh-btn,
  #adminApp .period-chip {
    white-space: normal;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
