* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fb;
    color: #1b2430;
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 30px 20px 50px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    gap: 20px;
}

.topbar h1 {
    font-size: 2.1rem;
    margin: 0;
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.active-set-banner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #edf7ef;
    border: 1px solid #cfead9;
    color: #0d7a40;
    font-size: 0.82rem;
    font-weight: 700;
}

.active-set-label,
.data-source-label,
.data-source-banner span {
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.7rem;
}

.data-source-card,
.data-source-banner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #dfe6f0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #344054;
}

.data-source-card a,
.data-source-banner strong {
    color: #0f172a;
    text-decoration: none;
    font-weight: 700;
    word-break: break-all;
}

.data-source-banner {
    margin-bottom: 18px;
    width: fit-content;
}

.set-switcher-form,
.set-create-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #dfe6f0;
    border-radius: 10px;
    padding: 8px 10px;
}

.set-switcher-form label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475467;
}

.set-switcher-form select,
.set-create-form input {
    border: 1px solid #d5dce7;
    border-radius: 8px;
    background: #fff;
    padding: 8px 10px;
    min-height: 36px;
}

.admin-link {
    display: inline-block;
    background: #1b2430;
    color: #fff;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 700;
}

.admin-box,
.copy-box {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.08);
}

@media (max-width: 767px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.admin-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 16px 50px;
}

.admin-box {
    padding: 18px;
}

.admin-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 18px;
    min-height: 700px;
}

.product-side,
.editor-panel {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px;
}

.product-side {
    display: flex;
    flex-direction: column;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.panel-head h3,
.editor-head h3 {
    margin: 0;
    font-size: 1.1rem;
}

.mini-btn {
    background: #1b2430;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    font-weight: 700;
    cursor: pointer;
}

.product-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.product-list li {
    border: 1px solid #dfe6f0;
    border-radius: 12px;
    background: #fff;
    cursor: grab;
}

.product-list li:active {
    cursor: grabbing;
}

.product-list li.selected {
    border-color: #0d7a40;
    box-shadow: 0 0 0 2px rgba(13, 122, 64, 0.12);
}

.product-list button {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 12px 12px;
    cursor: pointer;
    color: #1b2430;
}

.product-list .drag-handle {
    display: inline-block;
    font-size: 1rem;
    margin-right: 8px;
    color: #6b7280;
}

.product-list strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.95rem;
}

.product-list small {
    display: block;
    color: #53657d;
}

.product-list .state-pill {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #edf7ef;
    color: #0d7a40;
}

.product-list .state-pill.hidden {
    background: #fff1f1;
    color: #a62828;
}

.editor-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.editor-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full {
    grid-column: 1 / -1;
}

label {
    font-weight: 700;
    color: #344054;
}

input, textarea, button {
    font: inherit;
}

input, textarea {
    width: 100%;
    border: 1px solid #d5dce7;
    border-radius: 10px;
    padding: 11px 12px;
    background: #fff;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.primary-btn,
.secondary-btn,
.tool-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
}

.primary-btn {
    background: #0d7a40;
    color: #fff;
}

.secondary-btn,
.tool-btn {
    background: #eef3fb;
    color: #1b2430;
    border: 1px solid #d9e1f2;
}

.color-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
    cursor: pointer;
}

.color-swatch.active {
    box-shadow: 0 0 0 2px #111827, 0 0 0 5px rgba(17, 24, 39, 0.08);
}

.buttons-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.status {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #edf8f2;
    color: #0d7a40;
    border: 1px solid #cfead9;
    display: none;
}

.status.error {
    background: #fff1f1;
    color: #a62828;
    border-color: #f0c8c8;
}

.json-box {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.tiny-note {
    margin: 0 0 12px;
    font-size: 0.78rem;
    color: #475467;
    background: #f3f6fb;
    border: 1px solid #dfe6f0;
    border-radius: 8px;
    padding: 8px 10px;
}

.json-box textarea {
    min-height: 150px;
    background: #0f172a;
    color: #e2e8f0;
    border-color: #0f172a;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.8rem;
}

.table-wrap {
    margin-top: 24px;
    overflow-x: auto;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.product-table th,
.product-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.product-table th {
    background: #f8fafc;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #465266;
}

.inline-btn {
    display: inline-block;
    background: #eef3fb;
    border: 1px solid #d9e1f2;
    border-radius: 8px;
    padding: 8px 12px;
    text-decoration: none;
    color: #1b2430;
    font-weight: 700;
    margin-right: 8px;
    margin-bottom: 6px;
}

.delete-btn {
    background: #fdecec;
    border-color: #f2c3c3;
    color: #9b2c2c;
}

.copy-box {
    margin-top: 28px;
    padding: 22px 20px;
}

.copy-box textarea {
    min-height: 230px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.8rem;
    background: #0f172a;
    color: #e2e8f0;
    border-color: #0f172a;
}

@media (max-width: 640px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

.buttons-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.status {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    background: #edf8f2;
    color: #0d7a40;
    border: 1px solid #cfead9;
    display: none;
}

.status.error {
    background: #fff1f1;
    color: #a62828;
    border-color: #f0c8c8;
}

.table-wrap {
    margin-top: 24px;
    overflow-x: auto;
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.product-table th,
.product-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.product-table th {
    background: #f8fafc;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #465266;
}

.inline-btn {
    display: inline-block;
    background: #eef3fb;
    border: 1px solid #d9e1f2;
    border-radius: 8px;
    padding: 8px 12px;
    text-decoration: none;
    color: #1b2430;
    font-weight: 700;
    margin-right: 8px;
    margin-bottom: 6px;
}

.delete-btn {
    background: #fdecec;
    border-color: #f2c3c3;
    color: #9b2c2c;
}

.copy-box {
    margin-top: 28px;
    padding: 22px 20px;
}

.copy-box textarea {
    min-height: 230px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.8rem;
    background: #0f172a;
    color: #e2e8f0;
    border-color: #0f172a;
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}
