html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

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

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

a {
    color: #2563eb;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    background-color: #2563eb;
    color: #fff;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}

button:hover {
    background-color: #1d4ed8;
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.secondary-button {
    background-color: #475569;
}

.secondary-button:hover {
    background-color: #334155;
}

.danger-button {
    background-color: #dc2626;
}

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

.page-shell {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px 24px 80px;
    overflow-x: clip;
}

.page-header {
    text-align: center;
    margin-bottom: 24px;
}

.page-header h1 {
    margin: 0 0 8px;
    font-size: 2rem;
}

.page-header p {
    margin: 0;
    color: #64748b;
}

.page-meta {
    margin-top: 8px;
    font-size: 0.95rem;
}

.control-panel {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    margin-bottom: 16px;
    width: min(100%, 1100px);
    margin-left: auto;
    margin-right: auto;
}

.add-form,
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.toolbar {
    margin-top: 16px;
    justify-content: space-between;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 320px;
}

.field-group.small {
    flex: 0 0 160px;
}

.field-group label {
    font-size: 0.95rem;
    font-weight: 600;
}

.field-group input {
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-message {
    min-height: 24px;
    margin: 12px 0 4px;
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
    display: none;
}

.status-message.visible {
    display: block;
}

.status-message.success {
    background: #dcfce7;
    color: #166534;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
}

.results-summary {
    margin: 0 0 12px;
    color: #475569;
}

.profile-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
    align-items: start;
    row-gap: 20px;
    column-gap: 24px;
    padding: 8px 4px 0;
}

.profile-card {
    background: #fff;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    min-width: 0;
}

.profile-accordion {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    overflow: hidden;
}

.profile-summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.05rem;
    background: #eef2ff;
}

.profile-summary::-webkit-details-marker {
    display: none;
}

.profile-summary::after {
    content: "+";
    font-size: 1.25rem;
    line-height: 1;
    color: #475569;
}

.profile-accordion[open] .profile-summary::after {
    content: "-";
}

.profile-summary-title {
    word-break: break-word;
}

.profile-accordion-content {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-meta p {
    margin: 0;
    color: #475569;
    word-break: break-word;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.followers-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.followers-panel h3 {
    margin: 0;
    font-size: 1rem;
}

.followers-panel p {
    margin: 0;
    color: #475569;
}

.followers-chart {
    width: 100%;
    height: 120px;
    display: block;
    overflow: visible;
}

.followers-chart polygon,
.followers-chart polyline {
    fill: rgba(37, 99, 235, 0.08);
    stroke: #2563eb;
    stroke-width: 3;
    vector-effect: non-scaling-stroke;
}

.followers-chart circle {
    fill: #1d4ed8;
}

.embed-shell {
    width: 100%;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.embed-shell .instagram-media {
    width: min(100%, 540px) !important;
    max-width: 540px !important;
    min-width: 320px !important;
    margin: 0 !important;
}

.empty-state {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    color: #64748b;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.empty-state.hidden,
.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    z-index: 1000;
}

.modal-content {
    width: min(100%, 480px);
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.zoom-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1100;
}

.zoom-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.25rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.is-busy {
    cursor: progress;
}

@media (max-width: 768px) {
    .page-shell {
        padding: 16px 12px 72px;
    }

    .profile-container {
        grid-template-columns: 1fr;
    }

    .profile-card {
        width: 100%;
    }

    .embed-shell {
        min-height: 540px;
    }

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

    .toolbar-actions,
    .modal-buttons {
        width: 100%;
    }

    .toolbar-actions button,
    .modal-buttons button,
    .add-form button {
        width: 100%;
    }

    .field-group.small {
        flex-basis: 100%;
    }
}
