/* PANSHI gold theme - estudio de marca web - v2 (profesional) */
:root {
  --gold: #D4A56A;
  --gold-light: #F5EBD9;
  --gold-soft: #FAF5EB;
  --gold-dark: #B88547;
  --gold-darkest: #8B6332;
  --dark: #1F2937;
  --gray: #E5E7EB;
  --gray-light: #F9FAFB;
  --gray-mid: #6B7280;
  --red: #DC2626;
  --red-light: #FEE2E2;
  --green: #059669;
  --green-light: #D1FAE5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--gray-light);
  color: var(--dark);
  line-height: 1.5;
  font-size: 14px;
}

/* ===== Header ===== */
.panshi-header {
  background: white;
  border-bottom: 1px solid var(--gray);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
  color: var(--dark);
}
.brand-sub {
  font-size: 12px;
  color: var(--gray-mid);
  margin-top: 2px;
}
nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
nav a {
  color: var(--dark);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
nav a:hover { background: var(--gold-soft); color: var(--gold-dark); }
nav .user {
  font-size: 13px;
  color: var(--gray-mid);
  padding-left: 12px;
  border-left: 1px solid var(--gray);
}
nav .logout {
  background: var(--gold);
  color: white;
  margin-left: 4px;
}
nav .logout:hover { background: var(--gold-dark); color: white; }

/* ===== Main ===== */
main {
  max-width: 920px;
  margin: 28px auto;
  padding: 0 20px;
}

/* ===== Flash ===== */
.flash {
  padding: 13px 18px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}
.flash-error { background: var(--red-light); color: #7F1D1D; border-left: 4px solid var(--red); }
.flash-success { background: var(--green-light); color: #064E3B; border-left: 4px solid var(--green); }

/* ===== Login ===== */
.login-box {
  max-width: 420px;
  margin: 60px auto;
  background: white;
  padding: 36px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--gold);
}
.login-box h1 {
  margin: 0 0 24px;
  color: var(--dark);
  font-size: 22px;
}
.login-box label {
  display: block;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-mid);
}
.login-box input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--gray);
  border-radius: 8px;
  font-size: 14px;
  margin-top: 6px;
  transition: all 0.15s;
}
.login-box input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.login-box button {
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.login-box button:hover { background: var(--gold-dark); }
.login-box .hint { font-size: 12px; color: var(--gray-mid); margin-top: 20px; text-align: center; }

/* ===== Form card (general container) ===== */
.form-card, .job-card, .history-card {
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ===== Form Header (top of form-card) ===== */
.form-header {
  background: linear-gradient(135deg, var(--gold-soft) 0%, white 100%);
  padding: 28px 32px;
  border-bottom: 1px solid var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.form-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: -0.3px;
}
.form-header .lead {
  margin: 6px 0 0;
  color: var(--gray-mid);
  font-size: 13px;
}
.form-header-icon {
  font-size: 40px;
  opacity: 0.5;
}

/* ===== Form Sections (1, 2, 3) ===== */
.form-section {
  border-bottom: 1px solid var(--gray);
  padding: 0;
}
.form-section:last-of-type { border-bottom: none; }

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 32px 14px;
  background: var(--gray-light);
  border-bottom: 1px solid var(--gray);
}
.section-num {
  background: var(--gold);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.section-name { flex: 1; line-height: 1.3; }
.section-name strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--dark);
}
.section-name small {
  display: block;
  font-size: 12px;
  color: var(--gray-mid);
  font-weight: 400;
  margin-top: 2px;
}
.req-pill, .opt-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}
.req-pill {
  background: var(--red-light);
  color: var(--red);
}
.opt-pill {
  background: var(--gray);
  color: var(--gray-mid);
}

.section-body {
  padding: 20px 32px 24px;
}
.section-body.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* ===== Fields (individual inputs) ===== */
.field { display: flex; flex-direction: column; }
.field + .field { margin-top: 16px; }

.field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.field-icon {
  font-size: 14px;
  opacity: 0.9;
}
.field-name { font-weight: 600; }
.req-badge {
  font-size: 10px;
  font-weight: 600;
  background: var(--red-light);
  color: var(--red);
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 2px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.field-hint {
  font-size: 11px;
  color: var(--gray-mid);
  font-weight: 400;
  font-style: italic;
  margin-left: auto;
}

.field input[type=text],
.field input[type=email],
.field input[type=password],
.field textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--gray);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  transition: all 0.15s;
}
.field input[type=text]:focus,
.field input[type=email]:focus,
.field input[type=password]:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.field textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.5;
}

/* Required fields: subtle gold left accent on hover/focus */
.field.required input:focus {
  border-left: 3px solid var(--gold);
  padding-left: 12px;
}

/* File upload area */
.file-drop {
  position: relative;
  border: 2px dashed var(--gray);
  border-radius: 10px;
  background: var(--gray-light);
  transition: all 0.15s;
  overflow: hidden;
}
.file-drop:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.file-drop input[type=file] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-drop-text {
  display: block;
  text-align: center;
  padding: 20px;
  color: var(--gray-mid);
  font-size: 13px;
  font-weight: 500;
}

/* ===== Submit area ===== */
.form-submit {
  padding: 24px 32px 32px;
  background: var(--gold-soft);
  text-align: center;
}
button.primary.mega {
  background: var(--gold);
  color: white;
  border: none;
  padding: 16px 48px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 12px rgba(212, 165, 106, 0.35);
  transition: all 0.15s;
}
button.primary.mega:hover {
  background: var(--gold-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(212, 165, 106, 0.5);
}
button.primary.mega:active { transform: translateY(0); }
.submit-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--gray-mid);
  font-style: italic;
}

/* ============================================
   Classes Card (unified panel inside section 2)
   ============================================ */
.classes-card {
  margin: 0;
  background: white;
  border: 1px solid var(--gray);
  border-radius: 10px;
  overflow: hidden;
}
.cc-header {
  background: var(--gray-light);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--gray);
  font-size: 13px;
}
.cc-icon { font-size: 14px; opacity: 0.7; }
.cc-title { flex: 1; line-height: 1.2; }
.cc-title-es {
  font-weight: 600;
  font-size: 13px;
  color: var(--dark);
}
.cc-title-zh {
  font-size: 11px;
  color: var(--gray-mid);
  margin-top: 1px;
}
.cc-count {
  background: var(--gray);
  color: var(--gray-mid);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
  transition: all 0.2s;
}
.cc-count.has-items {
  background: var(--gold);
  color: white;
}

.cc-body {
  padding: 14px;
  min-height: 52px;
  background: white;
}
.empty-state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px;
  color: var(--gray-mid);
}
.empty-icon {
  font-size: 22px;
  color: var(--gray);
  font-weight: 700;
  line-height: 1;
}
.empty-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--gray-mid);
}
.empty-text small {
  font-size: 11px;
  color: #B0B0B0;
  display: block;
  margin-top: 2px;
}

.chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mini-chip {
  display: inline-flex;
  align-items: center;
  background: var(--gold);
  color: white;
  padding: 4px 6px 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  animation: chipAppear 0.15s ease;
}
.mini-chip small {
  color: rgba(255,255,255,0.9);
  font-weight: 400;
  margin-left: 5px;
  font-size: 10px;
}
.mini-chip button {
  background: rgba(255,255,255,0.25);
  border: none;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  margin-left: 6px;
  font-weight: 700;
}
.mini-chip button:hover { background: rgba(255,255,255,0.5); }
@keyframes chipAppear {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.clear-all-btn {
  background: transparent;
  color: var(--gray-mid);
  border: 1px solid var(--gray);
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.15s;
}
.clear-all-btn:hover {
  background: var(--red-light);
  color: var(--red);
  border-color: var(--red);
}

/* Picker inside the card */
.cc-picker {
  border-top: 1px solid var(--gray);
  background: white;
}
.cc-picker-toggle {
  cursor: pointer;
  padding: 11px 14px;
  background: white;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  list-style: none;
  transition: background 0.15s;
}
.cc-picker-toggle::-webkit-details-marker { display: none; }
.cc-picker-toggle:hover { background: var(--gold-soft); }
.cc-picker[open] .cc-picker-toggle {
  background: var(--gray-light);
  border-bottom: 1px solid var(--gray);
}
.picker-icon {
  background: var(--gold);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}
.picker-text { flex: 1; line-height: 1.2; }
.picker-text-main {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark);
  display: block;
}
.picker-text-sub {
  font-size: 11px;
  color: var(--gray-mid);
  display: block;
  margin-top: 1px;
}
.picker-chevron {
  font-size: 12px;
  color: var(--gray-mid);
  font-weight: 700;
  transition: transform 0.2s;
}
.cc-picker[open] .picker-chevron { transform: rotate(180deg); }

.pending-count {
  background: #EA580C;
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  display: none;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(234, 88, 12, 0); }
}

.grid-help {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--gray-mid);
  background: #FFFBEB;
  border-bottom: 1px solid var(--gold-light);
  line-height: 1.7;
}

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 6px;
  padding: 14px;
  background: white;
}
.class-grid button {
  background: white;
  border: 1.5px solid var(--gray);
  border-radius: 8px;
  padding: 8px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s;
  text-align: center;
  min-height: 56px;
  position: relative;
}
.class-grid button:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  transform: translateY(-1px);
}
.class-grid button.pending {
  background: #FEF3C7;
  border-color: var(--gold);
  border-style: dashed;
  border-width: 2px;
  color: var(--gold-darkest);
}
.class-grid button.pending::after {
  content: "⏳";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 10px;
}
.class-grid button.confirmed {
  background: var(--gold);
  border-color: var(--gold-dark);
  color: white;
  box-shadow: 0 2px 6px rgba(212, 165, 106, 0.4);
}
.class-grid button.confirmed::after {
  content: "✓";
  position: absolute;
  top: 2px;
  right: 5px;
  font-size: 11px;
  font-weight: 700;
  color: white;
}
.class-grid .g-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.class-grid .g-name {
  font-size: 10px;
  color: var(--gray-mid);
  line-height: 1.15;
  margin-top: 2px;
}
.class-grid button.confirmed .g-name { color: rgba(255,255,255,0.9); }
.class-grid button.pending .g-name { color: var(--gold-darkest); }

.grid-actions {
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--gray-light);
  border-top: 1px solid var(--gray);
}
.grid-actions button.primary {
  background: var(--gold);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.grid-actions button.primary:hover { background: var(--gold-dark); }
.grid-actions button.primary:disabled {
  background: var(--gray);
  color: var(--gray-mid);
  cursor: not-allowed;
}
.grid-actions button.secondary {
  background: white;
  color: var(--gray-mid);
  border: 1px solid var(--gray);
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.grid-actions button.secondary:hover { background: var(--gray-light); color: var(--dark); }

/* ============================================
   Job page (progress / result)
   ============================================ */
.job-card {
  padding: 36px;
}
.job-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
  color: var(--dark);
}
.job-card .meta {
  color: var(--gray-mid);
  font-size: 13px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray);
}
.job-card .meta b { color: var(--dark); }
.status-block {
  text-align: center;
  padding: 48px 0;
}
.progress-bar {
  width: 100%;
  height: 14px;
  background: var(--gray);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 18px;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  transition: width 0.5s ease;
  box-shadow: 0 0 8px rgba(212, 165, 106, 0.4);
}
.status-text {
  font-size: 14px;
  color: var(--gray-mid);
  min-height: 24px;
  font-weight: 500;
}

.result-block .prob-display {
  text-align: center;
  padding: 40px 24px;
  background: var(--gray-light);
  border-radius: 14px;
  margin-bottom: 24px;
}
.prob-label {
  font-size: 12px;
  color: var(--gray-mid);
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.prob-number {
  font-size: 80px;
  font-weight: 800;
  line-height: 1;
  margin: 12px 0;
  letter-spacing: -2px;
}
.prob-band {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-mid);
  letter-spacing: 0.3px;
}
.per-class-block h3 {
  color: var(--dark);
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
}
.per-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.per-class-item {
  background: white;
  padding: 18px 14px;
  border-radius: 12px;
  text-align: center;
  border: 1px solid var(--gray);
  border-left: 4px solid var(--gold);
  transition: transform 0.15s;
}
.per-class-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.cls-num { font-size: 12px; color: var(--gray-mid); font-weight: 600; }
.cls-pct { font-size: 30px; font-weight: 800; margin-top: 4px; }

.job-card .actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
button.primary, a.primary {
  background: var(--gold);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.15s;
}
button.primary:hover, a.primary:hover { background: var(--gold-dark); }
a.secondary {
  background: white;
  color: var(--gray-mid);
  border: 1px solid var(--gray);
  padding: 12px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
a.secondary:hover { background: var(--gray-light); color: var(--dark); }

.error-block { padding: 30px 0; text-align: center; }
.error-block pre {
  background: var(--red-light);
  color: #7F1D1D;
  padding: 16px;
  border-radius: 10px;
  text-align: left;
  white-space: pre-wrap;
  font-size: 13px;
  font-family: ui-monospace, monospace;
}

/* ============================================
   History page
   ============================================ */
.history-card {
  padding: 32px;
}
.history-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
}
.history-card .lead { margin-top: 0; }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 18px;
}
.history-table th, .history-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--gray);
}
.history-table th {
  background: var(--gray-light);
  color: var(--dark);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.history-table tr:hover { background: var(--gold-soft); }
.history-table .date { color: var(--gray-mid); font-size: 12px; }
.history-table .user-email { color: var(--gray-mid); font-size: 12px; }
.row-error td { background: #FEF2F2; }

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
}
.badge-error { background: var(--red-light); color: var(--red); }

.dl-btn {
  text-decoration: none;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
}
.dl-btn:hover { background: var(--gold-soft); }
.empty { text-align: center; color: var(--gray-mid); padding: 60px 0; }

/* ===== Footer ===== */
footer {
  text-align: center;
  font-size: 12px;
  color: var(--gray-mid);
  padding: 32px 20px;
}

/* ===== Responsive ===== */
@media (max-width: 720px) {
  main { margin: 16px auto; padding: 0 12px; }
  .form-header { padding: 20px; }
  .form-header h1 { font-size: 18px; }
  .form-header-icon { font-size: 28px; }
  .section-title, .section-body { padding-left: 18px; padding-right: 18px; }
  .section-body.two-col { grid-template-columns: 1fr; }
  .prob-number { font-size: 60px; }
  .history-table .date, .history-table .user-email { display: none; }
  .form-submit { padding: 20px; }
  button.primary.mega { width: 100%; padding: 14px; font-size: 15px; }
}
