*, ::before, ::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --amber: #d97706;
  --stone-50: #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-700: #44403c;
  --stone-800: #292524;
  --stone-900: #1c1917;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--stone-800);
  line-height: 1.6;
  background: var(--stone-50);
}

a { color: inherit; text-decoration: none; }

.max-w-4xl { max-width: 56rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-md { max-width: 28rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.bg-white { background: #fff; }
.bg-stone-50 { background: var(--stone-50); }
.bg-amber-50 { background: #fffbeb; }
.bg-amber-100 { background: #fef3c7; }
.bg-amber-600 { background: var(--amber); }
.bg-green-50 { background: #f0fdf4; }
.bg-green-600 { background: #16a34a; }
.bg-red-50 { background: #fef2f2; }

.text-white { color: #fff; }
.text-stone-400 { color: var(--stone-400); }
.text-stone-500 { color: var(--stone-500); }
.text-stone-600 { color: var(--stone-600); }
.text-stone-700 { color: var(--stone-700); }
.text-stone-800 { color: var(--stone-800); }
.text-amber-600 { color: var(--amber); }
.text-amber-700 { color: #b45309; }
.text-green-700 { color: #15803d; }
.text-red-600 { color: #dc2626; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.min-h-screen { min-height: 100vh; min-height: 100dvh; }
.hidden { display: none; }
.flex { display: flex; }
.grid { display: grid; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: .5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

.p-2 { padding: .5rem; }
.p-3 { padding: .75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.px-3 { padding-left: .75rem; padding-right: .75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: .25rem; padding-bottom: .25rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-3 { padding-top: .75rem; padding-bottom: .75rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mr-2 { margin-right: .5rem; }

.w-full { width: 100%; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.h-6 { height: 1.5rem; }

.rounded { border-radius: .25rem; }
.rounded-lg { border-radius: .5rem; }
.rounded-xl { border-radius: .75rem; }
.rounded-full { border-radius: 9999px; }
.border { border: 1px solid var(--stone-200); }
.border-stone-200 { border-color: var(--stone-200); }
.border-stone-300 { border-color: var(--stone-300); }
.border-b { border-bottom: 1px solid var(--stone-200); }
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,.05); }

.transition { transition: all .15s ease; }
.hover\:shadow-md:hover { box-shadow: 0 4px 6px rgba(0,0,0,.07); }
.hover\:bg-amber-700:hover { background: #b45309; }

select, input {
  width: 100%;
  padding: .625rem .75rem;
  border: 1px solid var(--stone-300);
  border-radius: .5rem;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--stone-800);
  outline: none;
  transition: border-color .15s;
}
select:focus, input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(217,119,6,.1);
}
select:focus-visible, input:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--stone-700);
  margin-bottom: .25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .75rem 1.5rem;
  border: none;
  border-radius: .5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--amber);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #b45309;
}
.btn-lg { padding: 1rem 2rem; font-size: 1.125rem; }
.btn-block { width: 100%; }

.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--stone-200);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.preview-card {
  background: #fff;
  border: 1px solid var(--stone-200);
  border-radius: .75rem;
  padding: 1rem;
  margin-bottom: .75rem;
}

.tag {
  display: inline-block;
  padding: .125rem .5rem;
  border-radius: .25rem;
  font-size: .75rem;
  font-weight: 500;
}
.tag-amber { background: #fef3c7; color: #92400e; }
.tag-green { background: #dcfce7; color: #166534; }
.tag-red { background: #fee2e2; color: #991b1b; }

table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--stone-100);
}
th {
  font-size: .75rem;
  font-weight: 600;
  color: var(--stone-500);
  text-transform: uppercase;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .875rem;
  color: var(--stone-500);
}
.back-link:hover { color: var(--stone-700); }

.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: .75rem 1rem;
  border-radius: .5rem;
  font-size: .875rem;
  z-index: 100;
  animation: slideIn .3s ease;
}
.toast-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.toast-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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