:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #657087;
  --line: #dbe3ef;
  --primary: #1a73e8;
  --primary-dark: #1558b0;
  --soft-primary: #e8f1ff;
  --warning: #fff6db;
  --warning-line: #f1d37b;
  --radius: 8px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-header h1,
.section-heading h2,
.session-card h2 {
  margin: 0;
  letter-spacing: 0;
}

.admin-header h1 {
  font-size: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.admin-top-links,
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.admin-top-links a,
.primary-link,
.secondary-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0 16px;
  border: 1px solid var(--line);
  color: var(--text);
  background: #fff;
  text-decoration: none;
  cursor: pointer;
}

.primary-link {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

.primary-link:hover {
  background: var(--primary-dark);
}

.secondary-link:hover,
.admin-top-links a:hover {
  background: var(--soft-primary);
  border-color: #b8cff4;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(23, 32, 51, 0.07);
}

.session-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.session-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.admin-hidden {
  display: none;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.admin-muted {
  color: var(--muted);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(150px, 180px) minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.filter-bar label {
  display: grid;
  gap: 6px;
}

.filter-bar label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filter-bar select,
.filter-bar input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: #fff;
}

.inquiry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 18px;
  padding: 18px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.inquiry-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.inquiry-table th,
.inquiry-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

.inquiry-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbff;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.inquiry-table tbody tr {
  cursor: pointer;
}

.inquiry-table tbody tr:hover,
.inquiry-table tbody tr.is-selected {
  background: var(--soft-primary);
}

.cell-date {
  white-space: nowrap;
}

.cell-message {
  max-width: 260px;
}

.message-snippet {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef3f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill[data-status="new"] {
  background: #fff0e5;
  color: #9a4b00;
}

.status-pill[data-status="open"] {
  background: #e8f1ff;
  color: var(--primary-dark);
}

.status-pill[data-status="closed"] {
  background: #e8f6ee;
  color: #166338;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 14px;
}

.pager span {
  min-width: 90px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.pager button:disabled {
  cursor: default;
  opacity: 0.45;
}

.inquiry-detail {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fbfdff;
}

.inquiry-detail h3 {
  margin: 0 0 12px;
  font-size: 19px;
}

.detail-grid {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf1f7;
}

.detail-row dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.detail-row dd {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.detail-message {
  white-space: pre-wrap;
}

.setup-warning {
  border: 1px solid var(--warning-line);
  border-radius: var(--radius);
  background: var(--warning);
  color: #604500;
  padding: 12px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .admin-header,
  .session-card,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-top-links,
  .admin-actions {
    justify-content: flex-start;
  }

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

  .filter-search {
    grid-column: 1 / -1;
  }

  .inquiry-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .admin-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

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

  .primary-link,
  .secondary-link,
  .admin-top-links a {
    width: 100%;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
