:root {
    --bg: #222;
    --panel: #2a2a2a;
    --panel-2: #303030;
    --border: #3a3a3a;
    --text: #e5e7eb;
    --muted: #a1a1aa;
    --accent: #3a3a3a;
    --accent-hover: #4a4a4a;
    --danger: #ef4444;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui;
    background: #222;
    color: var(--text);
    min-height: 100vh;
}

.app {
    max-width: 1200px;
    margin: auto;
    padding: 20px 30px 30px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.topbar-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn {
    border: 0;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary {
    background: #3a3a3a;
    color: white;
    border: 1px solid #4a4a4a;
}

.btn-primary:hover {
    background: #4a4a4a;
}

.btn-secondary {
    background: #2f2f2f;
    color: white;
    border: 1px solid #444;
}

.btn-danger {
    background: #4a2323;
    color: white;
    border: 1px solid #6b2c2c;
}

.btn-danger:hover {
    background: #5a2b2b;
}

.toolbar {
    display: grid;
    grid-template-columns: 1fr 250px;
    gap: 10px;
    margin-bottom: 20px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.control {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
    background: #2a2a2a;
}

.control input,
.control select {
    background: none;
    border: 0;
    color: white;
    width: 100%;
    outline: none;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.item-card {
    overflow: hidden;
}

.item-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.item-body {
    padding: 15px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.view-toggle {
    display: flex;
    border: 1px solid #444;
    border-radius: 10px;
    overflow: hidden;
    background: #2f2f2f;
}

.view-toggle-option {
    width: 42px;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.view-toggle-option + .view-toggle-option {
    border-left: 1px solid #444;
}

.view-toggle-option:hover {
    background: #3a3a3a;
    color: white;
}

.view-toggle-option.active {
    background: #4a4a4a;
    color: white;
}

.view-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

.price-tag {
    background: #065f46;
    padding: 6px 10px;
    border-radius: 8px;
}

.field-group {
    margin-bottom: 10px;
}

.field-group input {
    width: 100%;
    padding: 8px;
    background: #020617;
    border: 1px solid var(--border);
    color: white;
    border-radius: 8px;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.upload-preview {
    border: 1px dashed var(--border);
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    margin-top: 6px;
}

.upload-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    width: 500px;
    background: #020617;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.modal-header {
    padding: 18px;
    border-bottom: 1px solid var(--border);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* profile menu */

.profile-menu {
    position: relative;
}

.profile-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #020617;
    cursor: pointer;
}

.profile-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-dropdown {
    position: absolute;
    right: 0;
    top: 48px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    display: none;
    min-width: 120px;
    box-shadow: var(--shadow);
}

.profile-dropdown.open {
    display: block;
}

.dropdown-item {
    width: 100%;
    border: 0;
    background: none;
    color: white;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
}

.logout-item {
    display: flex;
    align-items: center;
    color: lightcoral;
    gap: 8px;
}

.logout-icon {
    width: 16px;
    height: 16px;
    color: lightcoral;
}

.dropdown-item:hover {
    background: var(--panel-2);
}

.profile-dropdown-username {
    padding: 4px 12px;
    text-align: center;
    font-weight: 600;
    color: var(--text);
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0 6px;
}

/* LIST VIEW */

.items-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.items-grid.list-view .item-card {
    display: none;
}

.item-list-row {
    display: grid;
    grid-template-columns: 72px 1fr auto auto;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
}

.item-list-image {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
}

.item-list-name {
    font-weight: 600;
    font-size: 1rem;
}

.item-list-price {
    font-weight: 700;
    color: #86efac;
    white-space: nowrap;
}

.item-list-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}