.admin-page {
  background: var(--bg);
}

.admin-shell {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
}

.admin-top {
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.08);
}

.admin-brand {
  gap: 18px;
  color: rgb(255 255 255 / 0.56);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.admin-brand::after {
  width: 1px;
  height: 20px;
  order: -1;
  margin-left: 98px;
  background: rgb(255 255 255 / 0.17);
  content: "";
}

.admin-brand img {
  position: absolute;
}

.admin-session {
  display: flex;
  align-items: center;
  gap: 16px;
  color: rgb(255 255 255 / 0.68);
  font-size: 12px;
}

.admin-session[hidden] {
  display: none;
}

.text-button {
  border: 0;
  padding: 8px 0;
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.admin-main {
  flex: 1;
}

.login-view {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding: 48px 20px;
  background:
    radial-gradient(circle at 52% 20%, rgb(64 144 78 / 0.1), transparent 32%),
    var(--bg);
}

.login-card {
  width: min(100%, 430px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 42px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.3;
  letter-spacing: -0.035em;
}

.login-card > p:not(.eyebrow, .auth-error) {
  margin: 12px 0 28px;
  color: var(--text-2);
  font-size: 14px;
}

.email-sign-in-form {
  display: grid;
  gap: 14px;
}

.email-sign-in-form .btn {
  width: 100%;
  cursor: pointer;
}

.admin-field {
  display: grid;
  gap: 7px;
}

.admin-field > span {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
}

.admin-field input,
.admin-field select {
  min-height: 44px;
  padding: 9px 12px;
}

.auth-error {
  margin: 18px 0 0;
  border-radius: 6px;
  padding: 11px 12px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 12px;
}

.login-back {
  margin: 28px 0 0;
}

.admin-view {
  min-width: 0;
  padding: 54px 0 80px;
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
}

.admin-heading h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.25;
  letter-spacing: -0.04em;
}

.admin-heading > div > p:not(.eyebrow) {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 14px;
}

.admin-heading .btn,
.surface-heading .btn {
  gap: 6px;
  cursor: pointer;
}

.admin-heading .material-symbols-rounded {
  font-size: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 0.72fr 0.72fr 1.56fr;
  gap: 14px;
  margin-top: 34px;
}

.summary-card {
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 22px;
  background: #ffffff;
}

.summary-label {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 650;
}

.summary-card strong {
  margin: 3px 0 1px;
  color: var(--ink);
  font-size: 32px;
  line-height: 1.25;
}

.summary-card > span:last-child {
  color: var(--text-3);
  font-size: 12px;
}

.summary-mail-card {
  background: var(--hero);
}

.summary-mail-card .summary-label,
.summary-mail-card > span:last-child {
  color: rgb(255 255 255 / 0.58);
}

.summary-mail-card strong {
  color: #ffffff;
  font-size: clamp(21px, 2.5vw, 30px);
  overflow-wrap: anywhere;
}

.admin-surface {
  min-width: 0;
  max-width: 100%;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #ffffff;
}

.settings-surface {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(420px, 1.35fr);
  align-items: end;
  gap: 52px;
  padding: 28px 30px;
}

.surface-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.surface-heading h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.surface-heading > div > p:not(.eyebrow) {
  margin: 7px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.settings-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
}

.settings-form .btn {
  min-height: 44px;
  cursor: pointer;
}

.inline-status {
  grid-column: 2;
  min-height: 18px;
  margin: 0;
  color: var(--text-3);
  font-size: 11px;
}

.state-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid #c7e2cc;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--brand-soft);
  color: #34773f;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.state-muted {
  border-color: var(--border);
  background: #fafafa;
  color: var(--text-3);
}

.state-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.state-info {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #4338ca;
}

.inquiries-surface {
  overflow: hidden;
}

.inquiry-toolbar {
  align-items: flex-end;
  padding: 28px 30px 22px;
  border-bottom: 1px solid var(--border);
}

.inquiry-filters {
  display: grid;
  gap: 10px;
}

.filter-set {
  display: grid;
  grid-template-columns: 46px auto;
  align-items: center;
  gap: 8px;
}

.filter-set > span {
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
}

.filter-tabs {
  display: flex;
  gap: 6px;
}

.filter-tab {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 12px;
  background: #ffffff;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.filter-tab.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.admin-loading,
.empty-state {
  min-height: 230px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 13px;
}

.admin-loading .material-symbols-rounded {
  color: var(--brand);
  font-size: 30px;
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.empty-state .material-symbols-rounded {
  color: #a1a1aa;
  font-size: 38px;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state p {
  margin: 0;
}

.inquiry-table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  contain: inline-size;
}

.inquiry-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.inquiry-table th,
.inquiry-table td {
  border-bottom: 1px solid var(--border);
  padding: 15px 14px;
  text-align: left;
  vertical-align: middle;
}

.inquiry-table th {
  background: #fafafa;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 650;
}

.inquiry-table td {
  color: var(--text-2);
  font-size: 12px;
}

.inquiry-table th:nth-child(1) { width: 112px; }
.inquiry-table th:nth-child(2) { width: 112px; }
.inquiry-table th:nth-child(3) { width: 160px; }
.inquiry-table th:nth-child(4) { width: 150px; }
.inquiry-table th:nth-child(6) { width: 95px; }
.inquiry-table th:nth-child(7) { width: 95px; }
.inquiry-table th:nth-child(8) { width: 54px; }

.service-badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inquiry-table tbody tr:hover {
  background: #fcfdfb;
}

.inquiry-person strong,
.inquiry-person span {
  display: block;
}

.inquiry-person strong {
  color: var(--ink);
  font-size: 13px;
}

.inquiry-person span {
  margin-top: 2px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-preview {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text-2);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.icon-button .material-symbols-rounded {
  font-size: 19px;
}

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

.inquiry-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 0;
  border-radius: 12px;
  padding: 34px;
  color: var(--text);
  box-shadow: 0 28px 90px rgb(11 16 13 / 0.28);
}

.inquiry-dialog::backdrop {
  background: rgb(11 16 13 / 0.66);
  backdrop-filter: blur(3px);
}

.dialog-close-form {
  position: absolute;
  top: 22px;
  right: 22px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-right: 42px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.03em;
}

.dialog-heading > div > p:not(.eyebrow) {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 26px 0 0;
  border-top: 1px solid var(--border);
}

.detail-grid div {
  padding: 16px 8px 16px 0;
  border-bottom: 1px solid var(--border);
}

.detail-grid dt {
  color: var(--text-3);
  font-size: 11px;
}

.detail-grid dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.detail-message,
.detail-delivery {
  margin-top: 24px;
}

.detail-message h3,
.detail-delivery h3 {
  margin: 0;
  font-size: 13px;
}

.detail-message p {
  margin: 9px 0 0;
  border-radius: 7px;
  padding: 16px;
  background: var(--bg);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.detail-delivery {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-radius: 7px;
  padding: 16px;
  background: var(--brand-soft);
}

.detail-delivery p {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: 12px;
}

.detail-delivery .btn {
  cursor: pointer;
  white-space: nowrap;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  margin-top: 24px;
}

.dialog-actions .btn {
  min-height: 44px;
  cursor: pointer;
}

.dialog-actions + .inline-status {
  margin-top: 9px;
}

@media (max-width: 840px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-mail-card {
    grid-column: 1 / -1;
  }

  .settings-surface {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .inline-status {
    grid-column: 1;
  }

  .inquiry-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .admin-shell {
    width: calc(100% - 32px);
  }

  .admin-brand span,
  .admin-brand::after,
  .admin-session > span {
    display: none;
  }

  .admin-brand img {
    position: static;
  }

  .login-card {
    padding: 30px 24px;
  }

  .admin-view {
    padding-top: 38px;
  }

  .admin-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .summary-mail-card {
    grid-column: auto;
  }

  .settings-surface,
  .inquiry-toolbar {
    padding: 22px 20px;
  }

  .settings-form {
    grid-template-columns: 1fr;
  }

  .filter-tabs {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .filter-tab {
    flex: 0 0 auto;
  }

  .inquiry-table {
    min-width: 860px;
  }

  .inquiry-dialog {
    width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: 12px 12px 0 0;
    padding: 28px 20px;
  }

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

  .detail-delivery,
  .dialog-actions {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .detail-delivery {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .admin-loading .material-symbols-rounded {
    animation: none;
  }
}
