:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #18202f;
  --muted: #657185;
  --line: #dce3ee;
  --primary: #246bfe;
  --primary-strong: #174fcb;
  --success: #117a4b;
  --warning: #9b6200;
  --danger: #bd2b2b;
  --shadow: 0 18px 48px rgba(21, 38, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
  animation: page-enter 420ms ease both;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: panel-enter 360ms ease both;
}

.hero {
  padding: 28px;
  margin-bottom: 20px;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
}

h2 {
  font-size: 22px;
}

.summary {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.blessing {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--success);
  font-weight: 700;
  line-height: 1.6;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.form-panel {
  padding: 24px;
}

.section-head {
  margin-bottom: 18px;
}

label {
  display: block;
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input {
  height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 220px;
  padding: 14px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 107, 254, 0.12);
}

fieldset {
  min-width: 0;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

fieldset:disabled {
  opacity: 0.56;
}

.inline-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

button {
  width: 100%;
  height: 46px;
  margin-top: 18px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(24, 32, 47, 0.12);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, opacity 150ms ease;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

button:not(:disabled):hover,
.link-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(24, 32, 47, 0.16);
}

button:not(:disabled):active,
.link-button:active,
button.is-clicked,
.link-button.is-clicked {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 6px 16px rgba(24, 32, 47, 0.14);
}

.primary-button {
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: #314158;
}

.danger-button,
.danger-inline-button {
  background: var(--danger);
}

.compact-button {
  margin-top: 0;
}

.guide-box {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.guide-box p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.link-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--primary);
  background: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(24, 32, 47, 0.08);
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, color 150ms ease;
}

.link-button:hover {
  border-color: rgba(36, 107, 254, 0.45);
}

.email-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(17, 122, 75, 0.3);
  border-radius: 8px;
  background: #f7fffb;
}

.email-card.hidden {
  display: none;
}

.email-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.email-card strong {
  display: block;
  margin-top: 4px;
  word-break: break-word;
}

.message {
  min-height: 22px;
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.message.is-updated {
  animation: message-pop 260ms ease both;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--success);
}

.status-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.status-card.is-updated,
.email-card:not(.hidden) {
  animation: card-pop 280ms ease both;
}

.status-card[data-status="failed"] {
  border-color: rgba(189, 43, 43, 0.35);
  background: #fff7f7;
}

.status-card[data-status="success"] {
  border-color: rgba(17, 122, 75, 0.3);
  background: #f7fffb;
}

.status-card.hidden {
  display: none;
}

#status-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

#status-title {
  display: block;
  margin-top: 12px;
  font-size: 20px;
}

#status-detail {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

#status-time {
  display: block;
  margin-top: 12px;
  color: var(--muted);
}

.admin-list-panel {
  margin-top: 20px;
}

.admin-head {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.compact-admin-button {
  width: 120px;
  margin-top: 0;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.order-table {
  table-layout: fixed;
}

.order-table th:nth-child(1),
.order-table td:nth-child(1) {
  width: 17%;
}

.order-table th:nth-child(2),
.order-table td:nth-child(2) {
  width: 18%;
}

.order-table th:nth-child(3),
.order-table td:nth-child(3) {
  width: 22%;
}

.order-table th:nth-child(4),
.order-table td:nth-child(4) {
  width: 13%;
}

.order-table th:nth-child(5),
.order-table td:nth-child(5) {
  width: 22%;
}

.order-table th:nth-child(6),
.order-table td:nth-child(6) {
  width: 8%;
}

.admin-table tbody tr {
  animation: row-enter 220ms ease both;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
}

.order-table .admin-cell-compact {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-table .admin-cell-compact code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: normal;
}

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

.admin-detail-row.hidden {
  display: none;
}

.admin-detail-row td {
  padding-top: 0;
  background: #fbfcff;
}

.admin-detail-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  animation: card-pop 220ms ease both;
}

.admin-detail-item {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: #f6f8fb;
}

.admin-detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-detail-item strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.inline-admin-button {
  width: auto;
  min-width: 72px;
  height: 34px;
  margin-top: 0;
  padding: 0 12px;
  background: #314158;
  font-size: 13px;
}

.inline-admin-button + .inline-admin-button {
  margin-left: 8px;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes message-pop {
  0% {
    opacity: 0.45;
    transform: translateY(4px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-pop {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes row-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 820px) {
  .shell {
    width: min(100% - 24px, 1120px);
    padding: 20px 0;
  }

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

  .hero,
  .form-panel {
    padding: 20px;
  }

  h1 {
    font-size: 27px;
  }

  .inline-action,
  .link-row,
  .button-row {
    grid-template-columns: 1fr;
  }

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