:root {
  --bg: #f0f2f5;
  --surface: #fff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #6200ee;
  --primary-hover: #5000c8;
  --primary-soft: #f3e8ff;
  --sidebar-active: #6200ee;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.btn-lang {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--muted);
}

.banner {
  background: linear-gradient(135deg, #f3e8ff, #ede9fe);
  border-bottom: 1px solid #ddd6fe;
  padding: 10px 20px;
  font-size: 0.875rem;
  color: #5b21b6;
  display: none;
}

.banner.visible { display: block; }

.page-intro { margin-bottom: 0; }
.page-intro h1 { font-size: 1.35rem; font-weight: 800; margin-bottom: 8px; line-height: 1.3; }
.page-intro p { font-size: 0.9rem; color: var(--muted); line-height: 1.55; }

.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
}

.sidebar { padding-right: 16px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.sidebar-link {
  display: block;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--sidebar-active);
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}

.form-column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(98, 0, 238, 0.12);
}

.type-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.type-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: #f9fafb;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  font-family: inherit;
}

.type-btn.active {
  background: var(--primary);
  color: #fff;
}

.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type='color'] { width: 42px; height: 38px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; padding: 2px; }
.color-row input[type='text'] { flex: 1; }

.field-check label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
}

.field-check input[type='checkbox'] { width: auto; accent-color: var(--primary); }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.logo-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.logo-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 8px;
  margin: 12px 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}

.logo-item {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.logo-item:hover {
  border-color: #c4b5fd;
}

.logo-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(98, 0, 238, 0.25);
}

.logo-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  display: block;
  pointer-events: none;
}

.logo-size-field input[type='range'] {
  width: 100%;
  accent-color: var(--primary);
}

.preview-column {
  position: sticky;
  top: 20px;
  text-align: center;
}

.preview-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 260px;
  background: #f9fafb;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

#qr-preview {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.download-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  text-align: left;
}

.download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: none;
  border-radius: 8px;
  background: #374151;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.dl-btn:hover:not(:disabled) { background: #1f2937; }
.dl-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.dl-icon {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  margin-top: 8px;
  width: 100%;
}

.error-msg { color: #dc2626; font-size: 0.85rem; margin-top: 4px; display: none; }
.error-msg.visible { display: block; }

.hint { font-size: 0.85rem; color: var(--muted); }

.hidden { display: none !important; }

.bulk-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.bulk-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.bulk-item canvas { max-width: 100%; }
.bulk-item p { font-size: 0.7rem; color: var(--muted); margin: 6px 0; word-break: break-all; }

.status-msg { margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: 0.875rem; background: #ecfdf5; color: #047857; }
.status-msg.error { background: #fef2f2; color: #b91c1c; }
.status-msg.hidden { display: none; }

.site-footer {
  text-align: center;
  padding: 20px 16px;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.site-footer p { margin-bottom: 10px; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: center;
}

.footer-nav a {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.header-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.header-nav a {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}

.header-nav a:hover { color: var(--primary); }

.info-main {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  width: 100%;
}

.info-article h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.info-updated {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.info-lead {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.info-section {
  margin-bottom: 24px;
}

.info-section h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.info-section p {
  font-size: 0.925rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 10px;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.team-card {
  text-align: center;
  padding: 24px 16px;
}

.team-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #9333ea);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}

.team-card h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.team-role {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.team-bio {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1024px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
    margin-bottom: 8px;
  }
  .sidebar { padding-right: 0; }
  .workspace { grid-template-columns: 1fr; }
  .preview-column { position: static; }
}

@media (max-width: 500px) {
  .form-row-2 { grid-template-columns: 1fr; }
  .app-body { padding: 12px; }
}
