body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f4f6f8;
    color: #1f2937;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto;
}

.card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 20px;
    margin-bottom: 20px;
}

h1, h2, h3 { margin-top: 0; }

input, select, button, textarea {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    margin-bottom: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    box-sizing: border-box;
}

button {
    background: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
}

button:hover { background: #1d4ed8; }

a.button-link {
    display: inline-block;
    background: #111827;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    margin-right: 8px;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.success {
    background: #dcfce7;
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

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

.photo-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 10px;
    display: block;
}

.photo-thumb-wrap {
    position: relative;
}

.photo-thumb-badge {
    position: absolute;
    left: 10px;
    bottom: 10px;
    background: rgba(17, 24, 39, 0.88);
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.topbar {
    background: #111827;
    color: white;
    padding: 14px 0;
}

.topbar a {
    color: white;
    text-decoration: none;
    margin-right: 12px;
}

.image-stage {
    overflow: auto;
}

.image-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    cursor: crosshair;
    line-height: 0;
}

.image-wrap img {
    max-width: min(100%, 920px);
    height: auto;
    display: block;
    border-radius: 10px;
}

.tag-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    background: transparent;
    width: auto;
    padding: 0;
    margin: 0;
    border: none;
    pointer-events: none;
}

.tag-dot {
    display: block;
    width: 18px;
    height: 18px;
    background: #ef4444;
    border: 3px solid #fff;
    border-radius: 999px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}

.tag-label {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
    line-height: 1.2;
}

.preview-marker { opacity: 0.75; }
.hidden { display: none; }

.row {
    display: grid;
    grid-template-columns: 1.4fr 0.8fr;
    gap: 16px;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 16px;
    align-items: end;
}

.hint-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
}

.tag-list {
    display: grid;
    gap: 10px;
}

.tag-list-item {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    background: #f9fafb;
}

.upload-preview {
    border: 1px dashed #94a3b8;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 16px;
    background: #f8fafc;
}

.upload-preview img {
    margin-top: 10px;
    max-width: 100%;
    max-height: 360px;
    border-radius: 10px;
    display: block;
}

.small { color: #6b7280; font-size: 14px; }

@media (max-width: 900px) {
    .row, .toolbar { grid-template-columns: 1fr; }
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.gallery-card {
    padding: 0;
    overflow: hidden;
}

.gallery-image-link img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
}

.gallery-card-body {
    padding: 16px;
}

.name-chip-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.name-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #3730a3;
    font-size: 13px;
    font-weight: 600;
}

.gallery-actions,
.person-card-footer,
.photo-card-actions,
.inline-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.person-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    background: #f9fafb;
}

.button-danger {
    background: #dc2626;
}

.button-danger:hover {
    background: #b91c1c;
}

.selectable-tag {
    text-align: left;
    background: #f9fafb;
    color: #111827;
    border: 1px solid #e5e7eb;
}

.selectable-tag.is-selected,
.stored-marker.is-selected .tag-dot {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.stored-marker.is-selected .tag-label {
    background: rgba(37, 99, 235, 0.95);
}

.edit-box {
    border: 1px solid #dbeafe;
    background: #eff6ff;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
}

.topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

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


.wide-card { width: 100%; }
.person-grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
  align-items: start;
}
.person-grid-form textarea {
  min-height: 110px;
}
.person-card-large {
  width: 100%;
}

.person-grid-form > button,
.person-grid-form > .upload-preview {
  grid-column: 1 / -1;
}

.person-grid-form label {
  font-weight: 600;
  margin-top: 2px;
}

.compact-form {
  margin-bottom: 18px;
}
