/* ─── Reset & Base ─── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  line-height: 1.6;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 32px;
  color: #111;
}

h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: #222;
}

/* ─── Blocks ─── */
.block {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

/* ─── Toggle Buttons ─── */
.toggle-group {
  display: flex;
  gap: 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
}

.toggle-btn {
  padding: 10px 28px;
  font-size: 0.95rem;
  border: none;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.toggle-btn:first-child {
  border-right: 1px solid #ccc;
}

.toggle-btn.active {
  background: #1a1a1a;
  color: #fff;
}

.toggle-btn:hover:not(.active) {
  background: #f5f5f5;
}

/* ─── Form Grid ─── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #444;
}

.required {
  color: #d00;
}

.field input,
.field select {
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #fff;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #333;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.field input.invalid,
.field select.invalid {
  border-color: #d00;
  box-shadow: 0 0 0 2px rgba(221, 0, 0, 0.1);
}

.api-note {
  font-size: 0.88rem;
  color: #666;
  margin-bottom: 16px;
}

.api-note code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85rem;
}

/* ─── Tables ─── */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  background: #f9f9f9;
  border-bottom: 2px solid #ddd;
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

tbody td {
  padding: 8px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

tbody tr:hover {
  background: #fafafa;
}

table input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: inherit;
}

table input:focus {
  outline: none;
  border-color: #333;
}

table input.invalid {
  border-color: #d00;
}

.num-cell {
  text-align: center;
  color: #888;
  font-weight: 500;
  min-width: 32px;
}

/* ─── Buttons ─── */
.add-btn {
  padding: 8px 20px;
  border: 1px dashed #aaa;
  border-radius: 5px;
  background: #fff;
  color: #555;
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.2s;
  font-family: inherit;
}

.add-btn:hover {
  border-color: #333;
  color: #111;
  background: #fafafa;
}

.remove-btn {
  padding: 4px 8px;
  border: none;
  background: none;
  color: #c00;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: color 0.2s;
}

.remove-btn:hover {
  color: #900;
}

#generate-btn {
  padding: 14px 36px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
  margin-top: 12px;
}

#generate-btn:hover {
  background: #333;
}

#generate-btn:disabled {
  background: #999;
  cursor: not-allowed;
}

/* ─── Status ─── */
.status {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  display: none;
}

.status.info {
  display: block;
  background: #eef6ff;
  color: #1a6fc4;
  border: 1px solid #c0daf5;
}

.status.success {
  display: block;
  background: #eaf7ea;
  color: #2e7d32;
  border: 1px solid #b8e0b8;
}

.status.error {
  display: block;
  background: #fdecea;
  color: #b71c1c;
  border: 1px solid #f5c6c6;
}

/* ─── Password Gate ─── */
#password-gate {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #f5f5f5;
}

.password-card {
  background: #fff;
  padding: 48px 40px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  text-align: center;
  max-width: 420px;
  width: 100%;
}

.password-card h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
  color: #111;
}

.password-card p {
  color: #666;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.password-row {
  display: flex;
  gap: 8px;
}

.password-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

.password-row input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.password-row button {
  padding: 10px 20px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
}

.password-row button:hover {
  background: #333;
}

.password-error {
  margin-top: 12px;
  color: #b71c1c;
  font-size: 0.9rem;
  min-height: 20px;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .container {
    padding: 0;
  }
  .block {
    padding: 16px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 1.4rem;
  }
}
