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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a1a;
  background: #f5f5f5;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* Header */
header {
  background: #1a1a2e;
  color: #fff;
  padding: 16px 0;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 720px;
}

.logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
}

.header-nav {
  font-size: 14px;
  opacity: 0.8;
}

.header-nav a {
  color: #fff;
}

/* Main */
main {
  flex: 1;
  padding: 32px 20px;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid #1a1a2e;
}

.subtitle {
  color: #666;
  margin-bottom: 28px;
  font-size: 15px;
}

/* Errors */
.errors {
  background: #fff0f0;
  border: 1px solid #e74c3c;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 24px;
}

.errors p {
  color: #c0392b;
  font-size: 14px;
  margin-bottom: 4px;
}

.errors p:last-child {
  margin-bottom: 0;
}

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

/* Fields */
.field {
  margin-bottom: 20px;
}

.field:last-child {
  margin-bottom: 0;
}

.field > label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.req {
  color: #e74c3c;
}

.optional {
  color: #999;
  font-weight: 400;
  font-size: 13px;
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  transition: border-color 0.2s;
  font-family: inherit;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #1a1a2e;
}

textarea {
  resize: vertical;
}

/* Checkboxes */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}

.other-text {
  margin-top: 8px;
}

/* Button */
.btn {
  display: inline-block;
  background: #1a1a2e;
  color: #fff;
  border: none;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.btn:hover {
  background: #16213e;
}

.btn-small {
  padding: 8px 18px;
  font-size: 14px;
}

form > .btn {
  margin-top: 8px;
}

/* Thanks page */
.thanks-page {
  text-align: center;
  padding-top: 60px;
}

.thanks-page h1 {
  margin-bottom: 12px;
}

.thanks-page p {
  margin-bottom: 12px;
}

.edit-link-box {
  display: flex;
  gap: 8px;
  max-width: 520px;
  margin: 16px auto;
  align-items: center;
}

.edit-link-box input {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #f9f9f9;
}

.hint {
  font-size: 13px;
  color: #888;
  margin-top: 8px;
}

/* Admin */
.admin-page h1 {
  margin-bottom: 0;
}

.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.total-badge {
  background: #1a1a2e;
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
}

.empty {
  text-align: center;
  color: #888;
  padding: 40px 0;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 20px;
}

.stat-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
}

.stat-label {
  flex: 0 0 200px;
  text-align: right;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-bar-wrap {
  flex: 1;
  height: 18px;
  background: #f0f0f0;
  border-radius: 3px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  background: #1a1a2e;
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.3s;
}

.stat-bar.bar-accent {
  background: #2980b9;
}

.stat-bar.bar-warn {
  background: #e67e22;
}

.stat-value {
  flex: 0 0 80px;
  font-size: 12px;
  color: #666;
}

/* Table */
.responses-section h2 {
  border-bottom: none;
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: #1a1a2e;
  color: #fff;
}

th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 500;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #e8e8e8;
}

tr:hover td {
  background: #f8f8f8;
}

.link {
  color: #1a1a2e;
  font-weight: 500;
}

/* Detail view */
dl {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px 16px;
}

dt {
  font-weight: 500;
  font-size: 14px;
  color: #555;
}

dd {
  font-size: 14px;
  white-space: pre-wrap;
}

/* Footer */
footer {
  padding: 16px 0;
  text-align: center;
  font-size: 13px;
  color: #999;
  border-top: 1px solid #e0e0e0;
  margin-top: 32px;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 0 16px;
  }

  .admin-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-label {
    flex: 0 0 120px;
    font-size: 12px;
  }

  .stat-value {
    flex: 0 0 60px;
  }

  dl {
    grid-template-columns: 1fr;
  }

  dt {
    margin-top: 8px;
  }

  .edit-link-box {
    flex-direction: column;
  }

  .admin-page .container {
    max-width: 100%;
  }
}

/* Admin wider container */
.admin-page.container {
  max-width: 960px;
}
