:root {
    --bg: #111318;
    --bg-elevated: #1a1d24;
    --bg-card: #22262f;
    --border: #333945;
    --text: #e8eaed;
    --text-muted: #9aa0a8;
    --accent: #c8a24a;
    --accent-hover: #dbb65a;
    --success: #4caf7d;
    --error: #e57373;
    --radius: 10px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

.topbar {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 600;
}

.subtitle {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #111;
    font-weight: 600;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover { border-color: var(--accent); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-ghost:hover { color: var(--text); }

.category {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-elevated);
}

.category-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-size: 1rem;
}

.category-name {
    font-weight: 600;
    color: var(--accent);
}

.category-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.category-body {
    padding: 0 1rem 1rem;
}

.category.collapsed .category-body { display: none; }

.realizacje-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.realizacja-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.realizacja-card.is-full { opacity: 0.85; }

.media-zone {
    margin-bottom: 0.75rem;
}

.zone-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.zone-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.zone-label {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropzone-featured {
    min-height: 90px;
}

.dropzone-featured .dropzone-thumb-img {
    width: 72px;
    height: 72px;
}

.dropzone-featured.has-files {
    justify-content: center;
}

.card-head {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.card-head-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.card-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.35;
}

.sync-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    font-size: 0.72rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.sync-badge.is-synced {
    color: var(--success);
    border-color: rgba(76, 175, 125, 0.45);
    background: rgba(76, 175, 125, 0.08);
}

.sync-badge.is-pending {
    color: #e6b84a;
    border-color: rgba(230, 184, 74, 0.45);
    background: rgba(230, 184, 74, 0.08);
}

.sync-badge.is-error {
    color: var(--error);
    border-color: rgba(229, 115, 115, 0.45);
    background: rgba(229, 115, 115, 0.08);
}

.card-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
}

.btn-sync-item {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-sync-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.dropzone-thumb.is-wp .dropzone-thumb-img {
    box-shadow: inset 0 0 0 1px rgba(200, 162, 74, 0.35);
}

.photo-badge {
    flex-shrink: 0;
    background: #2a2f3a;
    border: 1px solid var(--border);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

.realizacja-card.is-full .photo-badge {
    color: var(--success);
}

.dropzone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.dropzone:hover,
.dropzone.is-dragover {
    border-color: var(--accent);
    background: rgba(200, 162, 74, 0.06);
}

.dropzone.is-disabled {
    opacity: 0.75;
    cursor: not-allowed;
}

.dropzone.is-disabled .dropzone-inner,
.dropzone.is-disabled .dropzone-add-hint {
    pointer-events: none;
}

.dropzone.is-disabled .dropzone-thumb {
    pointer-events: auto;
    opacity: 1;
}

.dropzone.has-files {
    justify-content: flex-start;
    padding: 0.65rem;
}

.dropzone-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    width: 100%;
}

.dropzone-thumbs:empty {
    display: none;
}

.dropzone-thumb {
    position: relative;
    flex-shrink: 0;
}

.dropzone-thumb-img {
    display: block;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #1a1d24;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.1s;
}

.dropzone-thumb-img:hover {
    border-color: var(--accent);
    transform: scale(1.04);
}

.dropzone-thumb-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.dropzone-thumb-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.dropzone-thumb-delete:hover {
    color: var(--error);
    border-color: var(--error);
    background: rgba(229, 115, 115, 0.15);
}

.dropzone-inner {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.dropzone-inner[hidden] {
    display: none;
}

.dropzone-inner strong { color: var(--text); }

.dropzone-add-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.dropzone-add-hint[hidden] {
    display: none;
}

.dropzone-error {
    margin: 0;
    font-size: 0.82rem;
    color: var(--error);
}

.drop-icon {
    font-size: 1.5rem;
    color: var(--accent);
}

.card-status {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    min-height: 1.2em;
    color: var(--text-muted);
}

.card-status.is-success { color: var(--success); }
.card-status.is-error { color: var(--error); }

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.toast {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    max-width: 360px;
    z-index: 100;
}

.toast.is-error { border-color: var(--error); color: var(--error); }
.toast.is-success { border-color: var(--success); color: var(--success); }

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.login-box h1 { text-align: center; color: var(--accent); }

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.login-form label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-form input {
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 1rem;
}

.error {
    color: var(--error);
    font-size: 0.9rem;
    text-align: center;
}

@media (max-width: 640px) {
    .topbar-inner { flex-direction: column; align-items: stretch; }
    .topbar-actions { flex-direction: column; align-items: stretch; }
    .dropzone-thumb-img {
        width: 48px;
        height: 48px;
    }
}
