* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #3D2F35;
  background: #f8f4ef;
}

a {
  color: #6f4c3e;
}

.header {
  padding: 18px 24px;
  background: #fff;
  border-bottom: 1px solid #eadfd6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  font-weight: 800;
  font-size: 22px;
}

.header-sub {
  font-size: 14px;
  color: #7a6b65;
}

.container {
  width: min(960px, calc(100% - 32px));
  margin: 32px auto 80px;
}

.hero,
.complete-card,
.form-card,
.login-card,
.detail-card,
.template-download-card {
  background: #fff;
  border: 1px solid #eadfd6;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 12px 30px rgba(61, 47, 53, 0.06);
}

.hero {
  margin-bottom: 24px;
}

.form-card {
  margin-bottom: 28px;
}

.template-download-card {
  margin-top: 0;
  border-radius: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #9d725c;
  font-weight: 700;
  letter-spacing: .04em;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.25;
}

h2 {
  margin: 28px 0 16px;
  padding-top: 4px;
  font-size: 20px;
}

.template-download-card h2 {
  margin-top: 0;
  color: #0d1d44;
}

label {
  display: block;
  margin-bottom: 18px;
  font-weight: 700;
}

label span {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  background: #9d725c;
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  padding: 13px 14px;
  border: 1px solid #d8c9bf;
  border-radius: 12px;
  font-size: 16px;
  background: #fffdfb;
  color: #3D2F35;
}

textarea {
  resize: vertical;
}

.conditional-box {
  padding: 16px;
  background: #fbf6f1;
  border: 1px dashed #d8c9bf;
  border-radius: 14px;
  margin-bottom: 18px;
}

.small {
  font-size: 13px;
  color: #73615b;
}

.orientation-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.radio-card {
  margin: 0;
  padding: 16px;
  border: 1px solid #d8c9bf;
  border-radius: 16px;
  background: #fffdfb;
  cursor: pointer;
}

.radio-card input {
  width: auto;
  margin-right: 8px;
}

.radio-card span {
  background: none;
  color: #3D2F35;
  padding: 0;
  margin: 0;
  font-size: 16px;
}

.radio-card small {
  display: block;
  margin-top: 6px;
  color: #73615b;
  font-weight: 500;
}

.preview-wrap {
  margin: 16px 0 24px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid #eadfd6;
  background: #fffdfb;
  text-align: center;
}

.preview-title {
  margin-top: 0;
  font-weight: 800;
}

.card-preview-frame {
  margin: 0 auto;
  width: min(100%, 460px);
  background: #f7f1eb;
  border: 1px solid #d8c9bf;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.card-preview-frame.landscape {
  aspect-ratio: 85.60 / 53.98;
}

.card-preview-frame.portrait {
  width: min(100%, 310px);
  aspect-ratio: 53.98 / 85.60;
}

.card-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

#previewEmpty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #8a7b73;
  border: 1px dashed #d8c9bf;
  border-radius: 12px;
}

.submit-area {
  text-align: center;
  margin-top: 28px;
}

.submit-btn,
.link-btn {
  display: inline-block;
  width: auto;
  min-width: 180px;
  padding: 13px 22px;
  border: none;
  border-radius: 999px;
  background: #3D2F35;
  color: #fff;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  font-size: 16px;
}

.template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.template-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid #d9dde5;
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
  color: #0d1d44;
  transition: transform .15s ease, box-shadow .15s ease;
}

.template-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(13, 29, 68, .08);
}

.template-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #111;
  font-weight: 900;
  flex: 0 0 auto;
}

.template-icon.ai,
.template-icon.ppt {
  background: #ff9f2d;
}

.template-icon.word {
  background: #4777ff;
  color: #fff;
}

.template-icon.canva {
  background: #12b8cf;
  color: #fff;
}

.alert {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff1f1;
  color: #8a1f1f;
  border: 1px solid #efb5b5;
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
}

.admin-header {
  padding: 16px 24px;
  background: #3D2F35;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-header a {
  color: #fff;
}

.admin-container {
  width: min(1100px, calc(100% - 32px));
  margin: 28px auto 80px;
}

.search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.search-form input {
  margin: 0;
}

.search-form button {
  min-width: 96px;
  border: none;
  border-radius: 12px;
  background: #6f4c3e;
  color: #fff;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #eadfd6;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #eadfd6;
  text-align: left;
  font-size: 14px;
}

th {
  background: #fbf6f1;
}

.status {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fbf6f1;
  border: 1px solid #d8c9bf;
  font-weight: 700;
}

.detail-card dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px 16px;
}

.detail-card dt {
  font-weight: 800;
  color: #6f4c3e;
}

.detail-card dd {
  margin: 0;
  word-break: break-all;
}

@media (max-width: 700px) {
  .header,
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .hero,
  .complete-card,
  .form-card,
  .login-card,
  .detail-card,
  .template-download-card {
    padding: 20px;
    border-radius: 16px;
  }

  .orientation-group,
  .template-grid {
    grid-template-columns: 1fr;
  }

  .search-form {
    flex-direction: column;
  }

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


/* Template download device switching */
.template-download-mobile-only {
  display: none;
}

.template-download-desktop-only {
  display: flex;
}

@media (max-width: 760px) {
  .template-download-desktop-only {
    display: none !important;
  }

  .template-download-mobile-only {
    display: flex !important;
  }
}


/* additional v7 fixes */
.file-note {
  display: inline-block;
  margin-left: 8px;
  color: #73615b;
  font-size: 13px;
  font-weight: 600;
}

#previewEmpty {
  white-space: pre-line;
}

.complete-card .link-btn {
  display: block;
  width: fit-content;
  margin: 18px auto 0;
}
