* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-background, var(--base-background-color, #f5f5f2));
  color: var(--text-color, #202124);
  font-family: Arial, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--primary-color, #151515);
  color: #fff;
}

a {
  color: var(--primary-color, #7d2cff);
}

header a,
header button {
  color: #fff;
}

.brand {
  font-weight: 700;
  text-decoration: none;
}

nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

nav form {
  margin: 0;
}

main {
  width: min(1280px, calc(100% - 32px));
  margin: 32px auto;
}

.panel {
  width: 100%;
  max-width: 100%;
  background: var(--panel-background, #fff);
  border: 1px solid var(--panel-border-color, #ddd);
  border-radius: 8px;
  color: var(--panel-text-color, var(--text-color, #202124));
  padding: 24px;
  overflow: hidden;
}

.panel a {
  color: var(--primary-color, #7d2cff);
}

.narrow {
  max-width: 460px;
  margin: 0 auto;
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #b9b9b9;
  border-radius: 6px;
  font: inherit;
}

input[type="color"] {
  height: 44px;
  padding: 4px;
}

input[type="checkbox"] {
  width: auto;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

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

.design-preview {
  display: block;
  width: 100%;
  max-width: 260px;
  height: 120px;
  object-fit: cover;
  border: 1px solid var(--panel-border-color, #ddd);
  border-radius: 8px;
  background: #f2f2f2;
}

.design-bg-control {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--panel-border-color, #e2e2e2);
  border-radius: 8px;
  background: var(--form-background-color, #fafafa);
}

.muted {
  color: #60646c;
  font-size: 14px;
}

.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--button-color, #202124);
  color: #fff;
  cursor: pointer;
  font: inherit;
}

button:hover {
  filter: brightness(1.12);
}

button.danger {
  background: #a51d2d;
}

.upload-actions {
  display: grid;
  gap: 18px;
  margin-bottom: 28px;
}

.upload-form {
  display: flex;
  align-items: end;
  gap: 12px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--panel-border-color, #e2e2e2);
  border-radius: 8px;
  background: var(--form-background-color, #fafafa);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--panel-border-color, #e2e2e2);
  text-align: left;
  vertical-align: top;
}

th {
  white-space: normal;
}

td {
  overflow-wrap: anywhere;
}

.table-wrapper {
  width: 100%;
  max-width: 100%;
  margin-top: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--panel-border-color, #e2e2e2);
  border-radius: 8px;
  background: var(--table-background-color, #fff);
  -webkit-overflow-scrolling: touch;
}

.table-wrapper table {
  min-width: 760px;
}

.table-wrapper-wide table {
  min-width: 1180px;
}

.compact-table th,
.compact-table td {
  padding: 8px;
  font-size: 14px;
  line-height: 1.35;
}

.compact-table th {
  max-width: 140px;
}

td form {
  margin: 0 0 8px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
}

.inline-form input {
  min-width: 180px;
}

.status-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-badge.danger {
  background: #ffe4e6;
  color: #811827;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  background: #ffe4e6;
  color: #811827;
}

.notice.success {
  background: #dff6e7;
  color: #14532d;
}

.public-photo {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
}

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

.gallery-item {
  margin: 0;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f2f2f2;
}

.gallery-item figcaption {
  margin-top: 6px;
  color: #60646c;
  font-size: 14px;
}

code {
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  header,
  .upload-form {
    align-items: stretch;
    flex-direction: column;
  }

  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .panel {
    padding: 16px;
  }

  .table-wrapper table {
    min-width: 680px;
  }

  .table-wrapper-wide table {
    min-width: 1040px;
  }
}
