:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #1d232b;
  --muted: #68727d;
  --line: #d7dde4;
  --brand: #d8242f;
  --green: #0f8b6a;
  --blue: #276fbf;
  --amber: #b7791f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

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

button {
  cursor: pointer;
}

.inquiry-reply-editor {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

.inquiry-reply-editor textarea {
  width: 100%;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px;
  resize: vertical;
}

.inquiry-reply-editor small {
  color: var(--muted);
  font-size: 12px;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 12px clamp(16px, 4vw, 36px);
  box-shadow: 0 8px 20px rgba(29, 35, 43, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}

.admin-header nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-header a,
.admin-header button,
.tabs button,
.table-action {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  text-decoration: none;
  font-weight: 800;
}

.table-action {
  white-space: nowrap;
}

.admin-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.access-panel,
.dashboard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
}

.access-panel {
  display: grid;
  gap: 12px;
  max-width: 560px;
}

.access-panel h1,
.dashboard h1,
.panel h2 {
  margin: 0;
}

.access-panel p,
.empty,
.muted {
  color: var(--muted);
}

.access-panel form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.access-panel input,
.toolbar input,
.toolbar select,
.inline-input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.primary {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  padding: 0 14px;
  font-weight: 900;
}

.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.marketing-metric-grid,
.marketing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.marketing-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-marketing,
.admin-marketing > *,
.marketing-grid > * {
  min-width: 0;
}

.admin-marketing h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.tab-sep {
  align-self: stretch;
  width: 1px;
  margin: 2px 8px;
  background: var(--line);
}

.tabs button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
}

.panel-head h2 {
  margin: 0;
}

.panel-head .muted {
  margin: 0;
  font-size: 12px;
}

.tab-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding-top: 16px;
}

.panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar input[type="search"] {
  flex: 1 1 240px;
  min-width: min(240px, 100%);
}

.toolbar .table-action {
  min-height: 36px;
}

.menu-create-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(220px, 1.2fr);
  gap: 10px;
  align-items: end;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pagination > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination-size select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
  font-weight: 800;
}

.pagination-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pagination button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.pagination-gap {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  color: var(--muted);
  font-weight: 900;
}

.admin-note,
.reset-result {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.admin-note span,
.reset-result span,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.reset-result {
  border-color: #f0d2d5;
  background: #fff7f8;
}

.reset-result code {
  width: fit-content;
  border-radius: 6px;
  background: #fff;
  color: var(--brand);
  padding: 6px 8px;
  font-size: 16px;
  font-weight: 900;
}

.stacked-actions {
  display: grid;
  gap: 6px;
  align-items: start;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.inline-form .inline-input,
.inline-form input {
  flex: 1 1 110px;
  min-width: 0;
}

.verification-actions {
  display: grid;
  gap: 6px;
  min-width: 210px;
}

.verification-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.verification-row .table-action {
  flex: 1 1 0;
}

.date-adjust-form {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.date-adjust-form input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
}

.admin-menu-editor .data-table input,
.admin-menu-editor .data-table select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 8px;
}

.menu-tree-label {
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding-left: calc(var(--menu-depth, 0) * 18px);
}

.menu-tree-label::before {
  content: "";
  display: inline-block;
}

.menu-tree-label small {
  color: var(--muted);
  font-size: 11px;
}

.permission-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 210px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.permission-checklist legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.permission-checklist label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.permission-checklist.compact {
  border: 0;
  background: transparent;
  padding: 0;
}

.admin-ad-editor {
  gap: 16px;
}

.ad-create-grid,
.ad-edit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
}

.ad-create-grid label,
.ad-edit-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ad-create-grid input,
.ad-create-grid select,
.ad-create-grid textarea,
.ad-edit-grid input,
.ad-edit-grid select,
.ad-edit-grid textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.ad-create-grid textarea,
.ad-edit-grid textarea {
  resize: vertical;
}

.ad-create-grid .wide-field,
.ad-edit-grid .wide-field {
  grid-column: span 2;
}

.ad-enabled-field {
  min-height: 36px;
}

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

.ad-admin-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.ad-preview {
  display: grid;
  gap: 6px;
}

.ad-preview img,
.ad-preview span {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  object-fit: cover;
  overflow: hidden;
}

.ad-preview strong {
  overflow-wrap: anywhere;
}

.ad-preview small {
  color: var(--muted);
}

.ad-row-actions {
  display: grid;
  gap: 8px;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.check-inline input,
.admin-menu-editor input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.settings-form {
  display: grid;
  gap: 12px;
  max-width: 520px;
}

.settings-form label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.settings-form input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.data-table-scroll {
  width: 100%;
  max-height: 72vh;
  overflow: auto;
}

.data-table {
  min-width: 1080px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
}

.data-table td {
  overflow-wrap: normal;
}

.users-table-scroll .data-table {
  min-width: 1600px;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.data-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: #fff;
}

.users-table-scroll .data-table {
  min-width: 1380px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f8fa;
  color: #39424d;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--line);
}

.data-table tbody tr:hover td {
  background: #f8fafd;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.users-table-scroll .data-table td {
  white-space: nowrap;
}

.users-table-scroll input,
.users-table-scroll select,
.users-table-scroll button {
  white-space: nowrap;
}

.clip {
  display: -webkit-box;
  max-width: 420px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow-wrap: anywhere;
  white-space: normal;
}

.nowrap {
  white-space: nowrap;
}

.status {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  border-radius: 5px;
  background: #eef6ff;
  color: var(--blue);
  padding: 0 7px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.received,
.status.reviewing,
.status.pending {
  background: #fff7e8;
  color: var(--amber);
}

.status.resolved,
.status.published,
.status.approved {
  background: #e8f6f1;
  color: var(--green);
}

.status.rejected,
.status.suspended {
  background: #fdecef;
  color: var(--brand);
}

.status.secret {
  background: #eef1f4;
  color: var(--muted);
}

.cell-link,
.post-title-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.cell-link:hover,
.post-title-link:hover {
  text-decoration: underline;
}

.cell-link.slug {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.post-title-link {
  display: inline-block;
  max-width: 420px;
  font-weight: 900;
}

.member-link {
  display: inline-block;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--blue);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.member-link:hover {
  text-decoration: underline;
}

.member-link .muted {
  font-weight: 400;
}

.cell-btn {
  display: inline-block;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--blue);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.cell-btn:hover {
  border-color: var(--blue);
}

.row-links,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions {
  min-width: 200px;
}

.target-cell {
  min-width: 150px;
  max-width: 260px;
  overflow-wrap: anywhere;
}

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

.chip {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
}

.chip.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.content-filter {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
}

.content-filter input[type="search"] {
  min-width: min(280px, 100%);
  flex: 1 1 220px;
}

.content-filter select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
}

.danger {
  border-color: #f0c8cc;
  color: var(--brand);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100% - 36px));
  border-radius: 8px;
  background: #202833;
  color: #fff;
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--brand);
}

@media (max-width: 920px) {
  .metric-grid,
  .marketing-metric-grid,
  .marketing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ad-create-grid,
  .ad-edit-grid,
  .ad-admin-row,
  .menu-create-form {
    grid-template-columns: 1fr;
  }

  .ad-create-grid .wide-field,
  .ad-edit-grid .wide-field {
    grid-column: span 1;
  }

  .data-table-scroll {
    max-width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 560px) {
  .admin-shell {
    width: min(100% - 16px, 1440px);
  }

  .dashboard {
    min-width: 0;
    padding: 12px;
  }

  .admin-header,
  .dashboard-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .marketing-metric-grid,
  .marketing-grid,
  .access-panel form {
    grid-template-columns: 1fr;
  }
}
