* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-soft: #faf7f2;
  --text: #221b16;
  --muted: #756b63;
  --border: #e8ded2;

  --primary: #8b5e34;
  --primary-dark: #6f4725;
  --primary-soft: #f4e7d6;
  --accent: #c08457;

  --success: #047857;
  --success-bg: #ecfdf5;
  --warning: #92400e;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-bg: #fef2f2;

  --app-max: 1320px;
  --shadow: 0 24px 70px rgba(60, 42, 28, 0.12);
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(192, 132, 87, 0.28), transparent 32%),
    radial-gradient(circle at 92% 8%, rgba(139, 94, 52, 0.16), transparent 30%),
    linear-gradient(180deg, #f7f3ed 0%, #f2ece4 100%);
  overflow: auto;
}

.app-shell {
  width: 100%;
  max-width: var(--app-max);
  margin: 0 auto;
  padding: 28px 18px 44px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 20px 22px;
  margin-bottom: 16px;
  border: 1px solid rgba(232, 222, 210, 0.86);
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 250, 244, 0.78));
  box-shadow: 0 20px 55px rgba(60, 42, 28, 0.1);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #241912;
  color: #fff1dc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 4.2vw, 52px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero p {
  max-width: 780px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 220px;
}

.hero-actions .button {
  min-width: 160px;
  min-height: 48px;
}

.guide-card,
.workspace-card {
  border: 1px solid rgba(232, 222, 210, 0.9);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.guide-card {
  display: grid;
  grid-template-columns: 130px repeat(4, minmax(180px, 1fr));
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 24px;
  box-shadow: 0 14px 36px rgba(60, 42, 28, 0.08);
}

.guide-card h2 {
  margin: 0;
  padding-left: 4px;
  display: flex;
  align-items: center;
  color: var(--primary-dark);
  font-size: 18px;
}

.guide-step {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: start;
  min-height: 94px;
  padding: 12px;
  border: 1px solid rgba(232, 222, 210, 0.9);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(60, 42, 28, 0.04);
}

.guide-step span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  font-weight: 900;
}

.guide-step strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.guide-step p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.workspace-card {
  width: 100%;
  overflow: hidden;
  border-radius: 30px;
  box-shadow: 0 22px 64px rgba(60, 42, 28, 0.12);
}

.tabs {
  display: flex;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 247, 242, 0.9);
}

.tab-button {
  flex: 1;
  min-height: 50px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  padding: 14px 16px;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
  transition: 0.2s ease;
}

.tab-button:hover {
  background: rgba(139, 94, 52, 0.08);
}

.tab-button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(139, 94, 52, 0.22);
}

.tab-content {
  display: none;
  padding: 28px;
}

.tab-content.active {
  display: block;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.section-heading p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.form-section {
  margin-bottom: 24px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 250, 244, 0.88), rgba(255, 255, 255, 0.92));
  box-shadow: 0 16px 36px rgba(60, 42, 28, 0.07);
}

.form-section-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid rgba(232, 222, 210, 0.82);
}

.form-section-header h3 {
  margin: 0 0 5px;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.form-section-header p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.required-badge,
.setup-status,
.event-status {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.required-badge {
  background: #241912;
  color: #fff1dc;
}

.setup-status.success,
.event-status.success {
  background: var(--success-bg);
  color: var(--success);
}

.setup-status.warning,
.event-status.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.setup-status.error,
.event-status.error {
  background: var(--danger-bg);
  color: var(--danger-dark);
}

.required-star {
  color: var(--danger);
  font-weight: 900;
}

.form-grid,
.event-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.event-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff, #fffdf9);
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.event-card h4 {
  margin: 0 0 5px;
  color: var(--primary-dark);
  font-size: 18px;
}

.event-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #2e231b;
  font-size: 14px;
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(216, 202, 188, 0.96);
  border-radius: 15px;
  padding: 13px 14px;
  background: #fffdf9;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(192, 132, 87, 0.15);
}

input:disabled,
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input::placeholder,
textarea::placeholder {
  color: #b4a79b;
}

textarea {
  resize: vertical;
  min-height: 180px;
  line-height: 1.68;
}

#templateText {
  min-height: 420px;
  font-size: 15px;
  background: linear-gradient(180deg, #fffdf9, #ffffff);
}

small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.time-input-grid {
  display: grid;
  grid-template-columns: 1fr 110px 180px 1fr;
  gap: 10px;
  align-items: end;
}

.time-input-grid small {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
}

.time-input-grid select {
  font-weight: 900;
}

.preview-grid,
.stats-grid {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 14px;
  margin-bottom: 18px;
}

.stats-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.mini-card,
.stat-card,
.upload-panel {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(135deg, #fffaf4, #ffffff);
  padding: 16px;
  box-shadow: 0 10px 22px rgba(60, 42, 28, 0.05);
}

.mini-card span,
.stat-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mini-card strong {
  display: block;
  word-break: break-all;
  color: var(--primary-dark);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
}

.stat-card {
  border-radius: 24px;
}

.stat-card strong {
  display: block;
  color: var(--primary-dark);
  font-size: 32px;
  letter-spacing: -0.04em;
}

.template-token-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px dashed rgba(139, 94, 52, 0.28);
  border-radius: 18px;
  background: rgba(244, 231, 214, 0.42);
}

.template-token-box span {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--primary-dark);
  border: 1px solid rgba(139, 94, 52, 0.14);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 900;
}

.upload-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  border-radius: 24px;
}

.upload-panel h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.upload-panel p {
  margin: 0;
  color: var(--muted);
}

.upload-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#excelFile {
  max-width: 280px;
  background: #ffffff;
}

.sample-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 0 14px;
  border-radius: 14px;
  background: #241912;
  color: #fff1dc;
  text-decoration: none;
  font-size: 14px;
  font-weight: 900;
}

.action-row,
.list-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 0;
}

.list-actions {
  justify-content: flex-end;
  margin: 16px 0;
}

.button {
  min-height: 46px;
  border: 0;
  border-radius: 15px;
  padding: 13px 18px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.01em;
  transition: 0.2s ease;
}

.button.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(139, 94, 52, 0.24);
}

.button.primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.button.secondary {
  background: #fff7ed;
  color: var(--primary-dark);
  border: 1px solid rgba(139, 94, 52, 0.16);
}

.button.secondary:hover:not(:disabled) {
  background: #ead5ba;
  transform: translateY(-1px);
}

.button.danger {
  background: var(--danger);
  color: #ffffff;
}

.button.danger:hover:not(:disabled) {
  background: var(--danger-dark);
  transform: translateY(-1px);
}

.message {
  display: none !important;
}

.toast-container {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: min(560px, calc(100% - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 20px;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 24px 70px rgba(38, 26, 18, 0.22);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 800;
  animation: toastIn 0.22s ease;
}

.toast::before {
  content: "";
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--primary);
}

.toast.success {
  border-color: rgba(4, 120, 87, 0.22);
  background: #ecfdf5;
  color: #047857;
}

.toast.success::before {
  background: #047857;
}

.toast.error {
  border-color: rgba(220, 38, 38, 0.22);
  background: #fef2f2;
  color: #b91c1c;
}

.toast.error::before {
  background: #dc2626;
}

.toast.warning {
  border-color: rgba(146, 64, 14, 0.22);
  background: #fffbeb;
  color: #92400e;
}

.toast.warning::before {
  background: #f59e0b;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(60, 42, 28, 0.06);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

thead {
  background: #fff7ed;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 15px 14px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #7a6654;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td {
  color: #2f261f;
  font-size: 15px;
}

tbody tr {
  transition: background 0.16s ease;
}

tbody tr:hover {
  background: #fff8ef;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  padding: 40px;
  text-align: center;
  background: linear-gradient(135deg, #fffaf4, #ffffff);
  color: var(--muted);
  font-weight: 700;
}

.encoded-text {
  max-width: 240px;
  word-break: break-all;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge.pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-badge.copied {
  background: var(--success-bg);
  color: var(--success);
}

.status-badge.disabled {
  background: #f3f4f6;
  color: #6b7280;
}

.last-copy {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.copy-row-button {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  padding: 11px 13px;
  cursor: pointer;
  background: var(--primary);
  color: #ffffff;
  font-weight: 900;
  transition: 0.2s ease;
}

.copy-row-button:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.copy-row-button.copied {
  background: var(--success);
}

.input-error {
  border-color: var(--danger) !important;
  background: #fff7f7 !important;
  box-shadow: 0 0 0 5px rgba(220, 38, 38, 0.12) !important;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .app-shell {
    padding: 18px 12px 32px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .hero-actions {
    width: 100%;
    justify-content: flex-start;
    min-width: 0;
  }

  .hero-actions .button {
    width: 100%;
  }

  .guide-card {
    display: block;
    padding: 14px;
  }

  .guide-card h2 {
    margin-bottom: 12px;
  }

  .guide-step {
    min-height: auto;
    margin-bottom: 10px;
  }

  .tab-content {
    padding: 18px;
  }

  .section-heading,
  .form-section-header,
  .upload-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-grid,
  .event-grid,
  .preview-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .time-input-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-section {
    padding: 18px;
  }

  .upload-actions {
    width: 100%;
    justify-content: flex-start;
  }

  #templateText {
    min-height: 360px;
  }
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 32px;
  }

  .section-heading h2 {
    font-size: 24px;
  }

  .tabs,
  .action-row,
  .list-actions {
    flex-direction: column;
  }

  .time-input-grid {
    grid-template-columns: 1fr;
  }

  .button,
  .copy-row-button,
  .sample-link,
  #excelFile {
    width: 100%;
  }

  .template-token-box {
    gap: 6px;
  }

  .template-token-box span {
    font-size: 11px;
  }

  #templateText {
    min-height: 320px;
  }
}

/*
  LinkTamu — style.css
  Catatan:
  - Gunakan CSS final sebelumnya.
  - Tambahkan blok ini di bagian paling bawah style.css.
  - Blok ini memperbaiki UX area upload agar tombol Pilih File, Download CSV, dan Download Excel sejajar horizontal.
*/

.upload-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-upload-button,
.sample-link,
.sample-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 0 14px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: 0.2s ease;
}

.file-upload-button {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(139, 94, 52, 0.18);
}

.sample-link,
.sample-button {
  border: 1px solid rgba(139, 94, 52, 0.16);
  background: #241912;
  color: #fff1dc;
}

.sample-button {
  border: 0;
}

.file-upload-button:hover,
.sample-link:hover,
.sample-button:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.upload-actions:has(.file-input:disabled) .file-upload-button {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 980px) {
  .upload-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .upload-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .file-upload-button,
  .sample-link,
  .sample-button {
    width: 100%;
  }
}
