:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #66706b;
  --paper: #f4f2ed;
  --panel: #fff;
  --line: #dedfd9;
  --accent: #b56d35;
  --accent-dark: #82471e;
  --green: #2f694e;
  --blue: #315b7d;
  --red: #9a3b32;
  --shadow: 0 12px 35px rgba(23, 33, 29, 0.08);
  --app-sidebar-width: 232px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 17px;
  background: var(--paper);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none;
}

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(181, 109, 53, 0.09), transparent 34rem),
    var(--paper);
}

html.app-menu-open,
html.app-menu-open body {
  overflow: hidden;
}

a {
  color: var(--accent-dark);
  text-underline-offset: 0.18em;
}

button,
input,
select {
  font: inherit;
}

button,
.primary-button,
.secondary-button {
  min-height: 46px;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid rgba(181, 109, 53, 0.45);
  outline-offset: 3px;
}

.app-header {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 64px;
  padding: max(10px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  color: #fff;
  background: rgba(23, 33, 29, 0.96);
  backdrop-filter: blur(18px);
}

.brand-mark,
.auth-brand {
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--ink);
  background: #efe9dc;
  font-weight: 800;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.auth-brand {
  width: 64px;
  height: 64px;
  margin: 0 auto 22px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  font-size: 1.55rem;
}

.app-menu-trigger {
  display: grid;
  width: 44px;
  height: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 15px;
  background: transparent;
}

.app-menu {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: #fff;
  background: transparent;
}

.app-menu::backdrop {
  background: rgba(10, 16, 13, 0.58);
  backdrop-filter: blur(3px);
}

.app-menu-panel {
  display: flex;
  flex-direction: column;
  width: min(330px, 86vw);
  height: 100%;
  padding:
    max(14px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background: var(--ink);
  box-shadow: 20px 0 55px rgba(10, 16, 13, 0.32);
  animation: app-menu-enter 180ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

@keyframes app-menu-enter {
  from {
    transform: translateX(-100%);
  }
}

.app-menu-heading {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  margin-bottom: 28px;
}

.nav-button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  color: #fff;
  background: transparent;
}

.app-menu-links {
  display: grid;
  gap: 6px;
}

.app-menu-links a,
.app-menu-links span {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 14px 12px;
  border-radius: 12px;
  color: #fff;
  font-weight: 750;
  text-decoration: none;
}

.app-menu-links a:active {
  background: rgba(255, 255, 255, 0.1);
}

.app-menu-links [aria-disabled="true"] {
  opacity: 0.46;
}

.menu-signout {
  margin: auto 0 0;
  padding-top: 24px;
}

.menu-signout .nav-button {
  width: 100%;
  padding: 0 12px;
  text-align: left;
}

.app-sidebar {
  display: none;
}

.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 28px;
  padding: 0 12px;
}

.app-sidebar .app-menu-links a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.12);
}

.app-main {
  position: relative;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 34px max(18px, env(safe-area-inset-right)) max(48px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.auth-shell {
  width: min(430px, 100%);
  margin: max(5vh, 28px) auto 0;
  text-align: center;
}

.auth-shell h1,
.page-heading h1 {
  margin: 4px 0 8px;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.eyebrow {
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.muted,
.result-count,
.request-meta,
.request-card time,
.detail-heading time,
.timeline time,
small {
  color: var(--muted);
}

.panel {
  margin: 18px 0;
  padding: 22px;
  border: 1px solid rgba(23, 33, 29, 0.08);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 1.2rem;
}

.panel h3 {
  margin: 24px 0 10px;
  font-size: 1rem;
}

.form-stack {
  display: grid;
  gap: 17px;
  text-align: left;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid #c8cbc4;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font-size: 16px;
}

input:focus,
select:focus {
  border-color: var(--accent);
}

.primary-button,
.secondary-button {
  display: inline-grid;
  place-items: center;
  padding: 11px 17px;
  border-radius: 12px;
  font-weight: 750;
  text-decoration: none;
}

.primary-button {
  border: 1px solid var(--ink);
  color: #fff;
  background: var(--ink);
}

.secondary-button {
  border: 1px solid #bec2ba;
  color: var(--ink);
  background: #fff;
}

.inline-button {
  width: auto;
}

.alert {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: 13px;
  text-align: left;
}

.alert-error {
  border: 1px solid #e1b5b0;
  color: #722820;
  background: #fff1ef;
}

.alert-success {
  border: 1px solid #b5d5c4;
  color: #204f3a;
  background: #eef8f2;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.detail-heading {
  align-items: center;
  margin-top: 18px;
}

.count-badge {
  padding: 9px 13px;
  border-radius: 999px;
  color: #fff;
  background: var(--accent-dark);
  font-weight: 750;
  white-space: nowrap;
}

.pull-refresh {
  --pull-distance: 0px;
  position: fixed;
  z-index: 8;
  top: calc(70px + env(safe-area-inset-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid rgba(23, 33, 29, 0.12);
  border-radius: 999px;
  opacity: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  pointer-events: none;
  transform: translate(-50%, calc(-120% + var(--pull-distance)));
  transition: opacity 150ms ease, background-color 150ms ease;
}

.pull-refresh.is-active {
  opacity: 1;
}

.pull-refresh.is-ready {
  color: #fff;
  background: var(--green);
}

.pull-refresh-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

.pull-refresh.is-refreshing .pull-refresh-spinner {
  animation: pull-refresh-spin 700ms linear infinite;
}

@keyframes pull-refresh-spin {
  to {
    transform: rotate(360deg);
  }
}

.install-note {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 13px 15px;
  border: 1px solid #d7ccb9;
  border-radius: 14px;
  color: #554531;
  background: #fff9ec;
  font-size: 0.9rem;
}

.install-note[hidden] {
  display: none;
}

.install-note div {
  display: grid;
  gap: 2px;
}

.install-note button {
  flex: 0 0 44px;
  min-height: 44px;
  margin: -7px -9px -7px 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #685a47;
  background: transparent;
  font-size: 1.45rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(150px, 0.8fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.result-count {
  margin: 12px 2px;
  font-size: 0.88rem;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 9px;
  border: 0;
  border-radius: 10px;
  color: var(--accent-dark);
  background: transparent;
  font-size: 0.88rem;
  font-weight: 750;
}

.refresh-button span {
  font-size: 1.15rem;
}

.request-list {
  display: grid;
  gap: 12px;
}

.request-swipe {
  position: relative;
  display: flex;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 7px 22px rgba(23, 33, 29, 0.055);
  isolation: isolate;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x pan-y pinch-zoom;
}

.request-swipe::-webkit-scrollbar {
  display: none;
}

.request-swipe:not([data-swipe-ready]) .swipe-rail,
.request-swipe:not([data-swipe-ready]) .swipe-delete-commit {
  display: none;
}

.swipe-rail,
.swipe-delete-commit {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
}

.swipe-rail-start {
  flex-basis: 94px;
  background: var(--green);
  scroll-snap-align: start;
}

.swipe-rail-end {
  flex-basis: 184px;
  scroll-snap-align: end;
}

.swipe-delete-commit {
  flex-basis: calc(100% - 184px);
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--red);
  font-weight: 800;
}

.swipe-action {
  display: grid;
  width: 92px;
  height: 100%;
  min-height: 44px;
  place-items: center;
  padding: 10px 8px;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: transparent;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.swipe-action-read {
  width: 94px;
}

.swipe-action-reply {
  background: var(--blue);
}

.swipe-action-delete {
  background: var(--red);
}

.request-swipe[data-delete-armed] .swipe-rail-end {
  background: var(--red);
}

.request-swipe[data-delete-armed] .swipe-rail-end .swipe-action {
  visibility: hidden;
}

.request-card {
  position: relative;
  flex: 0 0 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 29, 0.1);
  border-radius: 18px;
  color: inherit;
  background: var(--panel);
  scroll-snap-align: start;
}

.request-card-link {
  display: block;
  min-height: 100%;
  padding: 18px 62px 18px 18px;
  color: inherit;
  text-decoration: none;
}

.request-card-link:active {
  opacity: 0.86;
}

.card-more-button {
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 8px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.card-more-button:active {
  background: rgba(23, 33, 29, 0.07);
}

.request-unread {
  border-left: 5px solid var(--accent);
}

.request-card-top,
.request-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.request-card-title {
  margin-top: 13px;
  font-size: 1.08rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.status-new {
  color: #71370e;
  background: #f7dfc6;
}

.status-in_progress {
  color: #244b68;
  background: #dcebf5;
}

.status-replied {
  color: #24513b;
  background: #dceee4;
}

.status-closed {
  color: #505753;
  background: #e7e9e7;
}

.status-spam {
  color: #7a2922;
  background: #f4d9d6;
}

.new-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.request-meta,
.request-location,
.request-excerpt {
  margin: 7px 0 0;
}

.request-location {
  font-weight: 650;
}

.request-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: #444d48;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.back-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  font-weight: 700;
  text-decoration: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
}

.detail-grid div {
  min-width: 0;
}

.detail-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.detail-grid dd {
  margin: 0;
  white-space: pre-wrap;
}

.break-text {
  overflow-wrap: anywhere;
}

.note-block {
  margin-top: 22px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
}

.note-block p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.status-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.read-state-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 750;
}

#actions,
#reply {
  scroll-margin-top: calc(82px + env(safe-area-inset-top));
}

.action-sheet {
  width: min(520px, calc(100% - 24px));
  max-height: calc(100vh - env(safe-area-inset-top) - 16px);
  margin: auto auto 0;
  padding: 14px 18px max(18px, env(safe-area-inset-bottom));
  overflow: auto;
  border: 0;
  border-radius: 24px 24px 0 0;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 -18px 50px rgba(23, 33, 29, 0.22);
}

.action-sheet::backdrop {
  background: rgba(10, 16, 13, 0.46);
  backdrop-filter: blur(3px);
}

.action-sheet-handle {
  width: 44px;
  height: 5px;
  margin: 0 auto 15px;
  border-radius: 999px;
  background: #b6bab4;
}

.action-sheet h2 {
  margin: 0;
  font-size: 1.25rem;
}

.action-sheet > p {
  margin: 5px 0 16px;
}

.action-sheet-actions {
  display: grid;
  gap: 9px;
}

.action-sheet-actions button,
.action-sheet-actions a {
  width: 100%;
  min-height: 48px;
  padding: 11px 15px;
  border: 1px solid #c8cbc4;
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}

.action-sheet-actions button:disabled {
  opacity: 0.45;
}

.action-sheet-actions .danger-action {
  color: var(--red);
}

.action-sheet-actions .desktop-sheet-reply {
  display: none;
}

.integration-state {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.integration-state p {
  margin: 5px 0 0;
  color: var(--muted);
}

.integration-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  background: #c88735;
}

.timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.timeline time {
  grid-column: 1 / -1;
  font-size: 0.82rem;
}

.stats-ranking {
  display: grid;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stats-ranking li,
.stats-ranking li > div {
  display: grid;
  gap: 7px;
}

.stats-ranking li > div {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
}

.stats-ranking progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: #e0ddd4;
}

.stats-ranking progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #e0ddd4;
}

.stats-ranking progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.stats-ranking progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.stats-chart {
  display: block;
  width: 100%;
  height: 104px;
  overflow: visible;
}

.stats-chart line {
  stroke: var(--line);
  stroke-width: 1;
}

.stats-chart rect {
  fill: var(--accent);
}

.stats-chart rect.stats-chart-zero {
  fill: #d8d6ce;
}

.stats-chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.75rem;
}

.timeline small {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 70px 24px;
  border: 1px dashed #c7cac4;
  border-radius: 22px;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 620px) {
  .app-main {
    padding-top: 26px;
  }

  .filter-bar,
  .status-form {
    grid-template-columns: 1fr;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .request-card-link {
    padding-right: 56px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .detail-heading {
    align-items: center;
  }
}

@media (min-width: 621px) {
  .action-sheet {
    margin: auto;
    border-radius: 24px;
  }
}

@media (min-width: 1000px) {
  .has-app-navigation .app-header,
  .has-app-navigation .app-menu {
    display: none;
  }

  .app-sidebar {
    position: fixed;
    z-index: 6;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: var(--app-sidebar-width);
    padding: 28px 20px 24px;
    overflow-y: auto;
    color: #fff;
    background: var(--ink);
    box-shadow: 20px 0 55px rgba(10, 16, 13, 0.18);
  }

  .has-app-navigation .app-main {
    width: min(760px, calc(100% - var(--app-sidebar-width)));
    margin-right: 0;
    margin-left: var(--app-sidebar-width);
    padding: 40px;
  }

  .has-app-navigation .app-main-inbox,
  .has-app-navigation .app-main-detail {
    width: min(1440px, calc(100% - var(--app-sidebar-width)));
  }

  .has-app-navigation .app-main-statistics {
    width: min(1120px, calc(100% - var(--app-sidebar-width)));
  }

  .app-main-inbox .request-swipe {
    overflow-x: hidden;
    scroll-snap-type: none;
    touch-action: auto;
  }

  .app-main-inbox .swipe-rail,
  .app-main-inbox .swipe-delete-commit {
    display: none;
  }

  .action-sheet-actions .desktop-sheet-reply {
    display: grid;
    place-items: center;
  }
}

@media (min-width: 1200px) {
  .detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    column-gap: 24px;
    align-items: start;
  }

  .detail-layout > .panel {
    margin: 0 0 24px;
  }

  .detail-request {
    grid-column: 1;
    grid-row: 1;
  }

  .detail-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .detail-reply {
    grid-column: 1;
    grid-row: 2;
  }

  .detail-activity {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (min-width: 1320px) {
  .app-main-inbox .request-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-main-inbox .request-swipe {
    height: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
  }
}
