/* ========================================
   Tibia Hunt Logger - Dashboard Style
   ======================================== */

:root {
    /* Colors */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-card: #18181b;
    --bg-card-hover: #1f1f23;
    --bg-input: #0f0f10;

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;

    --accent: #8b5cf6;
    --accent-hover: #a78bfa;
    --accent-muted: rgba(139, 92, 246, 0.15);

    --green: #22c55e;
    --green-muted: rgba(34, 197, 94, 0.15);
    --blue: #3b82f6;
    --blue-muted: rgba(59, 130, 246, 0.15);
    --red: #ef4444;
    --red-muted: rgba(239, 68, 68, 0.15);
    --purple: #a855f7;
    --purple-muted: rgba(168, 85, 247, 0.15);
    --yellow: #eab308;
    --yellow-muted: rgba(234, 179, 8, 0.15);
    --orange: #f97316;
    --orange-muted: rgba(249, 115, 22, 0.15);

    --delivery: #f59e0b;
    --delivery-bg: rgba(245, 158, 11, 0.12);
    --delivery-border: rgba(245, 158, 11, 0.4);

    --border: #27272a;
    --border-light: #3f3f46;

    /* Sizing */
    --sidebar-width: 240px;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Transitions */
    --transition: 200ms ease;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ========================================
   Layout
   ======================================== */

.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: var(--space-6);
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-muted);
    color: var(--accent);
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    transition: transform 0.2s ease;
}

.nav-item:hover .nav-icon svg {
    transform: scale(1.1);
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.sidebar-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Main Content */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--space-5);
    min-height: 100vh;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Profile Header
   ======================================== */

.profile-header {
    margin-bottom: var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.profile-info {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

/* Profile Selector */
.profile-selector {
    position: relative;
}

.profile-dropdown-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.profile-dropdown-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.profile-btn-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.profile-selector.open .profile-btn-arrow {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    z-index: 100;
    display: none;
}

.profile-selector.open .profile-dropdown {
    display: block;
    animation: dropdownIn 0.2s ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.profile-dropdown-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-list {
    max-height: 250px;
    overflow-y: auto;
}

.profile-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    cursor: pointer;
    transition: var(--transition);
}

.profile-item:hover {
    background: var(--bg-card-hover);
}

.profile-item.active {
    background: var(--accent-muted);
}

.profile-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-item-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.profile-item-world {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.profile-item-actions {
    display: flex;
    gap: var(--space-1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.profile-item:hover .profile-item-actions {
    opacity: 1;
}

.profile-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.profile-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.profile-action-btn.delete:hover {
    background: var(--red-muted);
    color: var(--red);
}

.profile-action-btn svg {
    width: 14px;
    height: 14px;
}

.profile-dropdown-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
}

.add-profile-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--accent-muted);
    border: 1px dashed var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.add-profile-btn:hover {
    background: var(--accent);
    color: white;
    border-style: solid;
}

.add-profile-btn .btn-icon {
    width: 18px;
    height: 18px;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

/* Wymagany modal (pierwsze uruchomienie) */
.modal.required .modal-backdrop {
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
}

.modal.required .modal-content {
    border: 2px solid var(--accent);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.3);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.3s ease;
    overflow: visible; /* Dla autocomplete dropdown */
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-5);
    overflow: visible; /* Dla autocomplete dropdown */
}

.form-group {
    margin-bottom: var(--space-4);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-group label .required {
    color: var(--red);
    font-weight: 600;
}

/* World input autocomplete */
.world-input-container {
    position: relative;
}

.world-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10000;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.world-suggestions.visible {
    display: block;
}

.world-suggestion-item {
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: background 0.15s ease;
}

.world-suggestion-item:hover,
.world-suggestion-item.selected {
    background: var(--bg-hover);
}

.world-suggestion-item .match {
    color: var(--accent);
    font-weight: 600;
}

/* Profile name row with fetch button */
.profile-name-row {
    display: flex;
    gap: var(--space-2);
}

.profile-name-row input {
    flex: 1;
}

.btn-fetch {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    font-size: 0.85rem;
    white-space: nowrap;
}

.btn-fetch:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-fetch.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Character info panel */
.character-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-bottom: var(--space-4);
}

.character-info.hidden {
    display: none;
}

.character-info-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-1) 0;
    font-size: 0.9rem;
}

.character-info-row:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.character-info-label {
    color: var(--text-muted);
}

.character-info-value {
    color: var(--text-primary);
    font-weight: 500;
}

.character-info-value.level {
    color: var(--accent);
}

.character-info-value.vocation {
    color: var(--green);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-5);
    border-top: 1px solid var(--border);
}

.btn-secondary {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-secondary.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    background: var(--accent-muted);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
}

.profile-avatar svg {
    width: 28px;
    height: 28px;
}

.profile-name {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0;
}

.profile-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ========================================
   Summary Cards
   ======================================== */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transition: all var(--transition);
}

.summary-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
}

.summary-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.summary-icon img {
    max-width: 32px;
    max-height: 32px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.summary-icon.green { background: var(--green-muted); }
.summary-icon.blue { background: var(--blue-muted); }
.summary-icon.purple { background: var(--purple-muted); }
.summary-icon.red { background: var(--red-muted); }

.summary-data {
    display: flex;
    flex-direction: column;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.summary-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-icon.orange { background: var(--orange-muted); }
.summary-icon.yellow { background: var(--yellow-muted); }

/* ========================================
   Boosted Section
   ======================================== */

.boosted-section {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.boosted-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.boosted-header {
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.boosted-header svg {
    color: var(--yellow);
}

.boosted-content {
    padding: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.boosted-loading {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.boosted-image {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
}

.boosted-info {
    flex: 1;
}

.boosted-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.boosted-bonus {
    font-size: 0.8rem;
    color: var(--green);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.boosted-bonus svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 900px) {
    .boosted-section {
        flex-direction: column;
    }
}

/* ========================================
   Charts
   ======================================== */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chart-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.chart-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
}

.chart-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.chart-body {
    padding: var(--space-4);
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    height: 120px;
    padding-top: var(--space-2);
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    min-width: 40px;
}

.bar-wrapper {
    width: 100%;
    height: 90px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.bar {
    width: 80%;
    max-width: 50px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--purple) 100%);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all 0.3s ease;
    position: relative;
    min-height: 4px;
}

.bar.profit {
    background: linear-gradient(180deg, var(--green) 0%, #16a34a 100%);
}

.bar.loss {
    background: linear-gradient(180deg, var(--red) 0%, #dc2626 100%);
}

.bar:hover {
    filter: brightness(1.2);
    transform: scaleY(1.02);
}

.bar-value {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}

.bar-item:hover .bar-value {
    opacity: 1;
}

.bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Top Monsters List */
.top-monsters-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.top-monster-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.top-monster-item:hover {
    background: var(--bg-card-hover);
}

.top-monster-rank {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-muted);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

.top-monster-rank.gold { background: var(--yellow-muted); color: var(--yellow); }
.top-monster-rank.silver { background: rgba(192, 192, 192, 0.2); color: #c0c0c0; }
.top-monster-rank.bronze { background: rgba(205, 127, 50, 0.2); color: #cd7f32; }

.top-monster-sprite {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a2e;
    border: 1px solid #3a3a3e;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.top-monster-sprite img {
    max-width: 32px;
    max-height: 32px;
    image-rendering: pixelated;
}

.top-monster-info {
    flex: 1;
}

.top-monster-name {
    font-weight: 500;
    font-size: 0.8rem;
}

.top-monster-count {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.top-monster-bar {
    flex: 1;
    max-width: 200px;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.top-monster-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Top Items Grid */
.top-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 36px);
    gap: 3px;
}

.top-item-slot {
    width: 36px;
    height: 36px;
    background: #2a2a2e;
    border: 1px solid #3a3a3e;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.top-item-slot:hover {
    border-color: #5a5a5e;
    background: #333338;
    transform: scale(1.15);
    z-index: 10;
}

.top-item-slot.delivery {
    border-color: var(--delivery);
    background: linear-gradient(135deg, #3a352a 0%, #2a2a2e 100%);
}

.top-item-slot img {
    max-width: 32px;
    max-height: 32px;
    image-rendering: pixelated;
}

.top-item-slot .item-quantity {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    -webkit-text-stroke: 1px #000;
    paint-order: stroke fill;
}

.top-item-slot .delivery-icon {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 12px;
    height: 12px;
    background: url('delivery_item.png') no-repeat center center;
    background-size: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Recent Hunts List */
.recent-hunts-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.recent-hunt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.recent-hunt-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.recent-hunt-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-hunt-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.recent-hunt-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.recent-hunt-stats {
    display: flex;
    gap: var(--space-4);
}

.recent-hunt-stat {
    text-align: right;
}

.recent-hunt-stat-value {
    font-weight: 700;
    font-size: 0.85rem;
    display: block;
}

.recent-hunt-stat-value.profit { color: var(--green); }
.recent-hunt-stat-value.loss { color: var(--red); }

.recent-hunt-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.section-link {
    font-size: 0.85rem;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.section-link:hover {
    color: var(--accent-hover);
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: var(--space-2);
}

.btn-large {
    padding: var(--space-4) var(--space-6);
    font-size: 1rem;
}

/* Empty Chart State */
.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 100px;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.85rem;
}

/* Gdy chart-empty jest w bar-chart, musi nadpisać flex-end */
.bar-chart .chart-empty {
    align-self: center;
    height: 120px;
}

/* Gdy chart-empty jest w top-items-grid (grid layout) */
.top-items-grid .chart-empty {
    grid-column: 1 / -1;
    min-height: 80px;
}

/* Gdy chart-empty jest w top-monsters-list (flex column) */
.top-monsters-list .chart-empty {
    min-height: 120px;
}

/* Gdy chart-empty jest w recent-hunts-list (flex column) */
.recent-hunts-list .chart-empty {
    min-height: 100px;
}

.chart-empty-icon {
    display: block;
    margin-bottom: var(--space-2);
    opacity: 0.5;
}

.chart-empty-icon svg {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
}

/* ========================================
   Section Cards
   ======================================== */

.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    overflow: visible; /* Zmienione z hidden dla autocomplete */
}

.section-card.hidden {
    display: none;
}

.section-header {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* SVG ikony w nagłówkach i przyciskach */
.section-icon,
.header-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--accent);
}

.btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

h1 .header-icon {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.chart-icon,
.panel-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-secondary);
    vertical-align: middle;
}

.chart-header h3,
.panel-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.sidebar-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.empty-icon svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    opacity: 0.5;
}

.section-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.section-body {
    padding: var(--space-4);
    overflow: visible; /* Dla autocomplete dropdown */
}

/* Hunt Name Badge */
.hunt-name-badge {
    background: var(--accent-muted);
    color: var(--accent);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: var(--space-2);
}

.hunt-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ========================================
   Input Area
   ======================================== */

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    overflow: visible; /* Dla autocomplete dropdown */
}

textarea {
    width: 100%;
    min-height: 160px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    color: var(--text-primary);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    resize: vertical;
    transition: border-color var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

textarea::placeholder {
    color: var(--text-muted);
}

.input-footer {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    overflow: visible; /* Dla autocomplete dropdown */
    position: relative;
    z-index: 10;
}

.input-footer input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

.input-footer input:focus {
    outline: none;
    border-color: var(--accent);
}

.input-footer input::placeholder {
    color: var(--text-muted);
}

/* Custom number input wrapper */
.number-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.number-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.number-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.number-btn:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.number-btn:active {
    background: var(--accent-muted);
}

.number-btn svg {
    width: 14px;
    height: 14px;
}

.level-input {
    width: 70px !important;
    flex: none !important;
    text-align: center;
    border: none !important;
    background: transparent !important;
    padding: var(--space-2) var(--space-1) !important;
}

.level-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Hide default spinner buttons */
.level-input::-webkit-inner-spin-button,
.level-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.level-input[type=number] {
    -moz-appearance: textfield;
}

/* Autocomplete dla nazwy spota */
.autocomplete-wrapper {
    position: relative;
    flex: 1;
}

.autocomplete-wrapper input {
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.autocomplete-dropdown.visible {
    display: block;
}

.autocomplete-item {
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: background 0.15s ease;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: var(--bg-hover);
}

.autocomplete-item-name {
    flex: 1;
    color: var(--text-primary);
}

.autocomplete-item-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.autocomplete-item-match {
    color: var(--accent);
    font-weight: 600;
}

.autocomplete-empty {
    padding: var(--space-3);
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* Autocomplete dla przedmiotów (w modal celów) */
.item-autocomplete-wrapper {
    position: relative;
    width: 100%;
}

.item-autocomplete-wrapper input {
    width: 100%;
}

.item-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    max-height: 250px;
    overflow-y: auto;
    z-index: 10000;
    display: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.item-autocomplete-dropdown.visible {
    display: block;
}

.item-suggestion {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    transition: background 0.15s ease;
}

.item-suggestion:hover,
.item-suggestion.selected {
    background: var(--bg-hover);
}

.item-suggestion-sprite {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.item-suggestion-sprite img {
    max-width: 28px;
    max-height: 28px;
    object-fit: contain;
}

.item-suggestion-info {
    flex: 1;
    min-width: 0;
}

.item-suggestion-name {
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-suggestion-category {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.item-suggestion-price {
    font-size: 0.75rem;
    color: var(--yellow);
    text-align: right;
    white-space: nowrap;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.btn .btn-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-danger-outline {
    background: transparent;
    color: var(--red);
    border: 1px solid var(--red);
}

.btn-danger-outline:hover {
    background: var(--red-muted);
}

/* ========================================
   Hunt Stats Grid
   ======================================== */

.hunt-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.hunt-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    text-align: center;
}

.hunt-stat.highlight-green {
    border-color: var(--green);
    background: var(--green-muted);
}

.hunt-stat.highlight-blue {
    border-color: var(--blue);
    background: var(--blue-muted);
}

.hunt-stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-1);
}

.hunt-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
}

/* ========================================
   Hunt Details Panels
   ======================================== */

.hunt-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
}

.hunt-detail-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.panel-badge {
    background: var(--accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: var(--space-1) var(--space-3);
    border-radius: 20px;
}

.panel-filters {
    display: flex;
    gap: var(--space-2);
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.filter-btn.delivery-filter.active {
    background: var(--delivery);
    border-color: var(--delivery);
}

.filter-delivery-icon {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 2px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.panel-content {
    max-height: 350px;
    overflow-y: auto;
    padding: var(--space-2);
}

.panel-content::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.panel-content::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

/* List Items */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.list-item:hover {
    background: var(--bg-card);
}

.list-item.delivery-item {
    background: var(--delivery-bg);
    border-left: 3px solid var(--delivery);
    margin: var(--space-1) 0;
}

.list-item.hidden {
    display: none;
}

.item-info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.item-name {
    font-size: 0.9rem;
}

.delivery-tag {
    background: var(--delivery);
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.item-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
}

/* Delivery Summary */
.delivery-summary {
    padding: var(--space-4);
    background: var(--delivery-bg);
    border-top: 1px solid var(--delivery-border);
    font-size: 0.85rem;
    color: var(--delivery);
    display: none;
}

.delivery-summary.visible {
    display: block;
}

.delivery-summary-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 4px;
}

/* ========================================
   History Page
   ======================================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.history-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* History Item */
.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.history-item:hover {
    border-color: var(--border-light);
}

.history-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-5);
    cursor: pointer;
}

.history-item-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.history-item-name {
    font-weight: 600;
    font-size: 1rem;
}

.hunt-level-badge {
    display: inline-block;
    background: var(--blue-muted);
    color: var(--blue);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: var(--space-2);
    vertical-align: middle;
}

.history-item-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-item-stats {
    display: flex;
    gap: var(--space-6);
    align-items: center;
}

.history-stat {
    text-align: right;
}

.history-stat-value {
    font-weight: 700;
    font-size: 1rem;
    display: block;
}

.history-stat-value.profit { color: var(--green); }
.history-stat-value.loss { color: var(--red); }

.history-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.history-item-actions {
    display: flex;
    gap: var(--space-2);
    margin-left: var(--space-4);
}

.history-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.history-btn.delete:hover {
    background: var(--red-muted);
    border-color: var(--red);
    color: var(--red);
}

.history-btn svg {
    width: 16px;
    height: 16px;
}

.history-item-details {
    display: none;
    padding: var(--space-5);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.history-item.expanded .history-item-details {
    display: block;
}

.history-details-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.history-detail {
    background: var(--bg-card);
    padding: var(--space-3);
    border-radius: var(--radius-sm);
}

.history-detail-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-bottom: var(--space-1);
}

.history-detail-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.history-delivery {
    background: var(--delivery-bg);
    border: 1px solid var(--delivery-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.history-delivery-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--delivery);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.delivery-title-icon {
    width: 18px;
    height: 18px;
}

.history-delivery-list {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* History Panels (Monsters & Loot) */
.history-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.history-panel {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card-hover);
    border-bottom: 1px solid var(--border);
}

.history-panel-header h4 {
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.history-panel-badge {
    background: var(--accent-muted);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.history-panel-content {
    max-height: 250px;
    overflow-y: auto;
    padding: var(--space-2);
}

.history-panel-content::-webkit-scrollbar {
    width: 6px;
}

.history-panel-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.history-panel-content::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.history-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.history-list-item:hover {
    background: var(--bg-secondary);
}

.history-list-item.delivery {
    background: var(--delivery-bg);
    border-left: 2px solid var(--delivery);
}

.history-list-item .history-item-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-primary);
}

.history-list-item .delivery-tag {
    font-size: 0.75rem;
}

.history-list-item .history-item-count {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.8rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-muted);
}

.empty-icon {
    display: block;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-icon svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.empty-icon-img {
    width: 64px;
    height: 64px;
    display: block;
    margin: 0 auto var(--space-4);
    opacity: 0.5;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.empty-state p {
    margin-bottom: var(--space-2);
}

/* ========================================
   Toast
   ======================================== */

#toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    z-index: 1000;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.9rem;
}

.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.info { border-left: 4px solid var(--blue); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.hiding {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(50px); }
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1600px) {
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1400px) {
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1200px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .hunt-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .history-details-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        width: 70px;
    }

    .sidebar-header, .sidebar-footer {
        padding: var(--space-3);
    }

    .logo-text, .nav-text {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: var(--space-3);
    }

    .sidebar-btn span:last-child {
        display: none;
    }

    .main {
        margin-left: 70px;
        padding: var(--space-4);
    }

    .hunt-details {
        grid-template-columns: 1fr;
    }

    .history-details-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .history-panels {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .hunt-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #monsters-list {
        grid-template-columns: repeat(auto-fill, 56px);
    }

    .monster-slot {
        width: 56px;
        height: 56px;
    }

    .history-monsters-grid {
        grid-template-columns: repeat(auto-fill, 56px);
    }

    .history-monster-item {
        width: 56px;
        height: 56px;
    }
}

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

    .hunt-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .input-footer {
        flex-direction: column;
    }

    .input-footer input {
        width: 100%;
    }

    .autocomplete-wrapper {
        width: 100%;
    }

    .history-item-main {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    .history-item-stats {
        width: 100%;
        justify-content: space-between;
    }

    .history-details-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .recent-hunt-item {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .recent-hunt-stats {
        width: 100%;
        justify-content: space-between;
    }

    .bar-chart {
        overflow-x: auto;
    }

    #monsters-list {
        grid-template-columns: repeat(auto-fill, 48px);
    }

    .monster-slot {
        width: 48px;
        height: 48px;
    }

    .history-monsters-grid {
        grid-template-columns: repeat(auto-fill, 48px);
    }

    .history-monster-item {
        width: 48px;
        height: 48px;
    }
}

/* ========================================
   Stash - Tibia Style Grid
   ======================================== */

/* Stash Toolbar */
.stash-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.stash-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
}

.stash-toolbar-row:last-child {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.stash-actions {
    display: flex;
    gap: var(--space-2);
}

/* Legacy - do usunięcia gdy nie używane */
.stash-controls {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

.stash-search input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-4);
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 200px;
}

.stash-search input:focus {
    outline: none;
    border-color: var(--accent);
}

.stash-search input::placeholder {
    color: var(--text-muted);
}

.stash-filters {
    display: flex;
    gap: var(--space-2);
}

.stash-filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.stash-filter-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.stash-filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.stash-filter-btn[data-filter="delivery"].active {
    background: var(--delivery);
    border-color: var(--delivery);
}

.stash-filter-btn[data-filter="sellable"].active {
    background: var(--success);
    border-color: var(--success);
}

/* Stash NPC filter */
.stash-npc-filter {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.stash-npc-filter label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.stash-npc-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: var(--space-2) var(--space-4);
    padding-right: var(--space-6);
    cursor: pointer;
    transition: all var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-2) center;
    min-width: 150px;
}

.stash-npc-select:hover {
    border-color: var(--border-light);
}

.stash-npc-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Multi-sell sticky bar */
.multi-sell-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border-top: 1px solid var(--accent);
    box-shadow: 0 -4px 20px rgba(139, 92, 246, 0.3);
    transform: translateY(0);
    transition: transform 0.3s ease-out;
}

.multi-sell-bar.hidden {
    transform: translateY(100%);
    pointer-events: none;
}

.multi-sell-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-3) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.multi-sell-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: white;
    font-weight: 500;
    font-size: 0.95rem;
}

.multi-sell-icon {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.multi-sell-separator {
    opacity: 0.4;
}

#multi-sell-value {
    color: var(--success);
    font-weight: 600;
}

.multi-sell-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-small {
    padding: var(--space-2) var(--space-3);
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.btn-icon-small {
    width: 16px;
    height: 16px;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-success {
    background: rgba(34, 197, 94, 0.1);
    border: 2px solid var(--success) !important;
    color: var(--success);
    font-weight: 600;
}

.btn-success:hover {
    background: var(--success);
    border-color: var(--success) !important;
    color: white;
}

/* Stash slot selected state (multi-sell mode) */
.stash-slot.selected {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3) 0%, rgba(124, 58, 237, 0.3) 100%);
}

.stash-slot.selected::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: 12px;
    background-position: center;
    background-repeat: no-repeat;
}

/* Multi-sell mode - cursor change */
.stash-grid.multi-sell-mode .stash-slot {
    cursor: pointer;
}

.stash-grid.multi-sell-mode .stash-slot:hover {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Stash Sort */
.stash-sort {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.stash-sort label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
}

.stash-sort-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: var(--space-2) var(--space-4);
    padding-right: var(--space-6);
    cursor: pointer;
    transition: all var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-2) center;
}

.stash-sort-select:hover {
    border-color: var(--text-secondary);
}

.stash-sort-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

.stash-sort-select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: var(--space-2);
}

/* Stash Stats Grid - nowy design */
.stash-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.stash-stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.stash-stat-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-hover);
}

.stash-stat-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.stash-stat-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.stash-stat-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.stash-stat-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stash-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.stash-stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.stash-stat-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Separator między statystykami */
.stash-stats-separator {
    grid-column: 1 / -1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: var(--space-1) 0;
}

/* Kolorowe warianty kart */
.stash-stat-delivery .stash-stat-icon {
    background: rgba(var(--delivery-rgb, 168, 85, 247), 0.15);
}
.stash-stat-delivery .stash-stat-icon img {
    filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.5));
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}
.stash-stat-delivery .stash-stat-value {
    color: var(--delivery);
}

.stash-stat-coins .stash-stat-icon {
    background: rgba(251, 191, 36, 0.15);
}
.stash-stat-coins .stash-stat-icon img {
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
}
.stash-value-coins {
    color: #fbbf24 !important;
}

.stash-stat-npc .stash-stat-icon {
    background: rgba(251, 191, 36, 0.1);
}
.stash-stat-npc .stash-stat-icon svg {
    color: var(--yellow);
}
.stash-value-npc {
    color: var(--yellow) !important;
}

.stash-stat-market .stash-stat-icon {
    background: rgba(34, 197, 94, 0.1);
}
.stash-stat-market .stash-stat-icon svg {
    color: var(--green);
}
.stash-value-market {
    color: var(--green) !important;
}

/* Total Value - wyróżniona karta */
.stash-stat-total {
    grid-column: span 1;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
    border-color: rgba(99, 102, 241, 0.3);
}
.stash-stat-total:hover {
    border-color: rgba(99, 102, 241, 0.5);
}
.stash-stat-total .stash-stat-icon {
    background: rgba(99, 102, 241, 0.2);
}
.stash-stat-total .stash-stat-icon svg {
    color: var(--accent);
}
.stash-value-total {
    color: var(--accent) !important;
    font-size: 1.35rem !important;
}

.stash-container {
    background: #1a1a1c;
    border: 2px solid #3a3a3e;
    border-radius: var(--radius-md);
    padding: var(--space-3);
    min-height: 400px;
}

.stash-grid {
    /* Inline-block zamiast grid - szybsze dla dużej ilości elementów */
    line-height: 0;
    font-size: 0;
    /* Optymalizacja wydajności */
    content-visibility: auto;
    contain-intrinsic-size: auto 500px;
}

.stash-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--text-muted);
    text-align: center;
}

.stash-empty.hidden {
    display: none;
}

/* Stash Item Slot */
.stash-slot {
    display: inline-block;
    vertical-align: top;
    width: 36px;
    height: 36px;
    margin: 1px;
    background: #2a2a2e;
    border: 1px solid #3a3a3e;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    text-align: center;
    /* contain izoluje element - szybsze renderowanie */
    contain: layout style paint;
}

.stash-slot:hover {
    border-color: var(--accent);
    background: #333338;
    z-index: 10;
    /* Usunięto transform i box-shadow - kosztowne przy wielu elementach */
}

.stash-slot:active {
    background: #3a3a40;
}

.stash-slot.delivery {
    border-color: var(--delivery);
    /* Zamiast box-shadow: inset - jaśniejsze tło */
    background: linear-gradient(135deg, #3a352a 0%, #2a2a2e 100%);
}

.stash-slot.hidden {
    display: none;
}

.stash-slot img {
    max-width: 32px;
    max-height: 32px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    /* Wyłącz pointer-events - tooltip jest obliczany matematycznie */
    pointer-events: none;
}

.stash-slot .item-quantity {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    /* Lżejsza alternatywa dla 4x text-shadow */
    -webkit-text-stroke: 1px #000;
    paint-order: stroke fill;
    line-height: 1;
    pointer-events: none;
}

.stash-slot .delivery-icon {
    position: absolute;
    top: -3px;
    left: -3px;
    width: 14px;
    height: 14px;
    background: url('delivery_item.png') no-repeat center center;
    background-size: contain;
    /* Usunięto filter: drop-shadow - bardzo wolny przy wielu elementach */
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    pointer-events: none;
}

/* Item Tooltip */
.item-tooltip {
    position: fixed;
    left: 0;
    top: 0;
    background: linear-gradient(180deg, #3a3a3e 0%, #2a2a2e 100%);
    border: 2px solid #5a5a5e;
    border-radius: 4px;
    padding: var(--space-3);
    min-width: 150px;
    max-width: 250px;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    /* GPU acceleration dla transform */
    will-change: transform;
    contain: layout style paint;
}

.item-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.tooltip-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: var(--space-1);
}

.tooltip-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tooltip-price {
    font-size: 0.8rem;
    color: var(--yellow);
    margin-top: var(--space-1);
    white-space: pre-line;
    line-height: 1.4;
}

.tooltip-price:empty {
    display: none;
}

.tooltip-delivery {
    font-size: 0.75rem;
    color: var(--delivery);
    margin-top: var(--space-1);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tooltip-delivery-icon {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.tooltip-delivery:empty {
    display: none;
}

/* ========================================
   Stash Modal
   ======================================== */

.stash-modal-content {
    max-width: 420px;
}

.stash-modal-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.stash-modal-sprite {
    width: 64px;
    height: 64px;
    background: #2a2a2e;
    border: 2px solid #3a3a3e;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stash-modal-sprite img {
    max-width: 56px;
    max-height: 56px;
    image-rendering: pixelated;
}

.stash-modal-sprite.delivery {
    border-color: var(--delivery);
    box-shadow: inset 0 0 12px rgba(245, 158, 11, 0.3);
}

.stash-modal-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.stash-modal-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.stash-modal-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stash-modal-count strong {
    color: var(--green);
}

.stash-modal-sold {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stash-modal-sold strong {
    color: var(--text-secondary);
}

.stash-modal-actions {
    margin-bottom: var(--space-4);
}

.stash-action-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.stash-input-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.stash-qty-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition);
}

.stash-qty-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
}

.stash-input-row input {
    flex: 1;
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
    font-weight: 600;
}

.stash-input-row input:focus {
    outline: none;
    border-color: var(--accent);
}

.stash-quick-btns {
    display: flex;
    gap: var(--space-2);
}

.stash-quick-btn {
    flex: 1;
    padding: var(--space-2);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}

.stash-quick-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-warning {
    background: transparent;
    border: 1px solid var(--yellow);
    color: var(--yellow);
}

.btn-warning:hover {
    background: var(--yellow-muted);
}

/* Add Stash Item Modal */
.add-stash-modal-content {
    max-width: 450px;
    overflow: visible;
}

.add-stash-modal-content .modal-body {
    overflow: visible;
}

.add-stash-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-top: var(--space-3);
}

.add-stash-preview-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.add-stash-preview-item img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.add-stash-preview-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.add-stash-preview-name {
    font-weight: 600;
    color: var(--text-primary);
}

.add-stash-preview-delivery {
    font-size: 0.8rem;
    color: var(--delivery);
    display: flex;
    align-items: center;
    gap: 4px;
}

.add-stash-preview-delivery img,
.add-stash-delivery-icon {
    width: 14px;
    height: 14px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* ========================================
   Monster & Loot Grids (Dashboard)
   ======================================== */

/* Monster Grid */
#monsters-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, 64px);
    gap: 6px;
    padding: var(--space-3);
}

.monster-slot {
    width: 64px;
    height: 64px;
    background: #2a2a2e;
    border: 1px solid #3a3a3e;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.monster-slot:hover {
    border-color: var(--accent);
    background: #333338;
    z-index: 10;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.monster-slot img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.monster-slot .monster-count {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    line-height: 1;
}

/* Boosted Monster Badge */
.monster-slot.boosted,
.history-monster-item.boosted {
    border-color: var(--yellow);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.1);
}

.monster-slot.boosted:hover,
.history-monster-item.boosted:hover {
    border-color: var(--yellow);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.boosted-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    background: linear-gradient(135deg, var(--yellow), #f59e0b);
    color: #000;
    font-size: 7px;
    font-weight: 800;
    padding: 1px 3px;
    border-radius: 3px;
    line-height: 1.2;
    text-transform: uppercase;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 5;
}

/* Loot Grid */
#loot-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, 36px);
    gap: 2px;
    padding: var(--space-2);
}

.loot-slot {
    width: 36px;
    height: 36px;
    background: #2a2a2e;
    border: 1px solid #3a3a3e;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.loot-slot:hover {
    border-color: #5a5a5e;
    background: #333338;
    z-index: 10;
    transform: scale(1.15);
}

.loot-slot.delivery {
    border-color: var(--delivery);
    background: linear-gradient(135deg, #3a352a 0%, #2a2a2e 100%);
}

.loot-slot.hidden {
    display: none;
}

.loot-slot img {
    max-width: 32px;
    max-height: 32px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.loot-slot .item-quantity {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    -webkit-text-stroke: 1px #000;
    paint-order: stroke fill;
    line-height: 1;
}

/* Delivery Icon - bez filter dla wydajności */
.delivery-icon {
    position: absolute;
    top: -2px;
    left: -2px;
    width: 14px;
    height: 14px;
    background: url('delivery_item.png') no-repeat center center;
    background-size: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* ========================================
   History Monster & Loot Grids
   ======================================== */

.history-monsters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 64px);
    gap: 4px;
    padding: var(--space-3) !important;
}

.history-monster-item {
    width: 64px;
    height: 64px;
    background: #2a2a2e;
    border: 1px solid #3a3a3e;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.history-monster-item:hover {
    border-color: var(--accent);
    background: #333338;
    z-index: 10;
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.history-monster-item img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.history-monster-item .monster-count {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
    line-height: 1;
}

.history-loot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 34px);
    gap: 2px;
    padding: var(--space-2) !important;
}

.history-loot-slot {
    width: 34px;
    height: 34px;
    background: #2a2a2e;
    border: 1px solid #3a3a3e;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.history-loot-slot:hover {
    border-color: #5a5a5e;
    background: #333338;
    z-index: 10;
    transform: scale(1.15);
}

.history-loot-slot.delivery {
    border-color: var(--delivery);
    background: linear-gradient(135deg, #3a352a 0%, #2a2a2e 100%);
}

.history-loot-slot img {
    max-width: 30px;
    max-height: 30px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.history-loot-slot .item-quantity {
    position: absolute;
    bottom: 0px;
    right: 1px;
    font-size: 8px;
    font-weight: 700;
    color: #fff;
    -webkit-text-stroke: 1px #000;
    paint-order: stroke fill;
    line-height: 1;
}

.history-loot-slot .delivery-icon {
    width: 12px;
    height: 12px;
    top: -2px;
    left: -2px;
}

/* ========================================
   Spawns Tab
   ======================================== */

.spawns-summary {
    display: flex;
    gap: var(--space-6);
    padding: var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.spawn-stat {
    text-align: center;
}

.spawn-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    display: block;
}

.spawn-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.spawns-table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.spawns-table {
    width: 100%;
    border-collapse: collapse;
}

.spawns-table thead {
    background: var(--bg-secondary);
}

.spawns-table th {
    padding: var(--space-4);
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.spawns-table th:hover {
    color: var(--text-primary);
}

.spawns-table th.sorted {
    color: var(--accent);
}

.sort-icon {
    font-size: 0.7rem;
    margin-left: 4px;
    opacity: 0.5;
}

.spawns-table th.sorted .sort-icon {
    opacity: 1;
}

.spawns-table th.sorted.asc .sort-icon::after {
    content: '▲';
}

.spawns-table th.sorted.desc .sort-icon::after {
    content: '▼';
}

.spawns-table tbody tr {
    border-top: 1px solid var(--border);
    transition: background 0.2s;
    cursor: pointer;
}

.spawns-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.spawns-table td {
    padding: var(--space-4);
    font-size: 0.9rem;
}

.spawns-table td:first-child {
    font-weight: 600;
}

.spawns-table .profit {
    color: var(--green);
}

.spawns-table .loss {
    color: var(--red);
}

.spawns-table .xp {
    color: var(--blue);
}

.spawns-empty {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-muted);
    display: none;
}

.spawns-empty.visible {
    display: block;
}

.spawns-empty .empty-icon {
    display: block;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.spawns-empty .empty-icon svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.spawns-empty .hint {
    font-size: 0.85rem;
    margin-top: var(--space-2);
}

/* ========================================
   Goals Section
   ======================================== */

.btn-small {
    padding: var(--space-2) var(--space-3);
    font-size: 0.8rem;
}

.goals-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.goals-empty {
    text-align: center;
    padding: var(--space-4);
    color: var(--text-muted);
    display: none;
}

.goals-empty.visible {
    display: block;
}

.goals-empty .hint {
    font-size: 0.85rem;
    margin-top: var(--space-1);
}

.goal-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.goal-item:hover {
    border-color: var(--border-light);
}

.goal-item.completed {
    border-color: var(--green);
    background: var(--green-muted);
}

.goal-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.goal-icon img {
    max-width: 40px;
    max-height: 40px;
    image-rendering: pixelated;
}

.goal-icon svg {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.goal-info {
    flex: 1;
}

.goal-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: var(--space-1);
}

.goal-target {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.goal-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.goal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.goal-item.completed .goal-progress-fill {
    background: var(--green);
}

.goal-stats {
    text-align: right;
    flex-shrink: 0;
}

.goal-progress-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
}

.goal-item.completed .goal-progress-text {
    color: var(--green);
}

.goal-progress-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.goal-progress-sublabel {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.goal-actions {
    display: flex;
    gap: var(--space-2);
}

.goal-delete-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.goal-delete-btn:hover {
    background: var(--red-muted);
    border-color: var(--red);
    color: var(--red);
}

.goal-delete-btn svg {
    width: 16px;
    height: 16px;
}

/* Goal Modal */
.goal-modal-content {
    max-width: 450px;
    overflow: visible; /* Dla autocomplete dropdown */
}

.goal-modal-content .modal-body {
    overflow: visible;
}

.form-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-group.hidden {
    display: none;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* XP Calculator styles */
.xp-calc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.xp-calc-field label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

.xp-calc-field input {
    width: 100%;
}

.xp-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-4) 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.xp-divider::before,
.xp-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.xp-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-top: var(--space-3);
}

.xp-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
    font-size: 0.85rem;
}

.xp-preview-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

.xp-preview-label {
    color: var(--text-secondary);
}

.xp-preview-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: var(--font-mono);
}

.xp-preview-total {
    margin-top: var(--space-2);
    padding-top: var(--space-3);
}

.xp-preview-total .xp-preview-label {
    color: var(--accent);
    font-weight: 600;
}

.xp-preview-total .xp-preview-value {
    color: var(--accent);
    font-size: 1rem;
}

/* ========================================
   Compare Modal
   ======================================== */

.compare-modal-content {
    max-width: 800px;
    width: 95%;
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

.compare-column {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.compare-header {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
}

.compare-header h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.compare-header .compare-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.compare-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.compare-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-card);
    border-radius: var(--radius-sm);
}

.compare-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.compare-stat-value {
    font-size: 0.95rem;
    font-weight: 600;
}

.compare-stat-value.better {
    color: var(--green);
}

.compare-stat-value.worse {
    color: var(--red);
}

.compare-stat-value.neutral {
    color: var(--text-primary);
}

.compare-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.compare-btn:hover {
    background: var(--accent-muted);
    border-color: var(--accent);
    color: var(--accent);
}

.compare-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.compare-btn svg {
    width: 16px;
    height: 16px;
}

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

/* ========================================
   Line Charts (Trend)
   ======================================== */

.chart-period-btns {
    display: flex;
    gap: var(--space-2);
}

.chart-period-btns {
    display: flex;
    gap: var(--space-1);
}

.period-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
}

.period-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.period-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.line-chart {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.line-chart-svg {
    width: 100%;
    height: auto;
    aspect-ratio: 500 / 150;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    display: block;
}

.line-chart-path {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.line-chart-path.profit {
    stroke: var(--green);
}

.line-chart-path.xp {
    stroke: var(--blue);
}

.line-chart-area {
    /* Gradient fill is set inline */
}

.line-chart-point {
    fill: var(--bg-card);
    stroke: var(--accent);
    stroke-width: 3;
    cursor: pointer;
    transition: all 0.15s ease;
}

.line-chart-point.profit {
    stroke: var(--green);
}

.line-chart-point.xp {
    stroke: var(--blue);
}

.line-chart-point:hover {
    fill: var(--accent);
}

.line-chart-point.profit:hover {
    fill: var(--green);
}

.line-chart-point.xp:hover {
    fill: var(--blue);
}

.line-chart-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 var(--space-1);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chart-summary {
    display: flex;
    justify-content: space-around;
    padding: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.chart-summary-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.chart-summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-summary-value.profit {
    color: var(--green);
}

.chart-summary-value.xp {
    color: var(--blue);
}

.chart-summary-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.line-chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.line-chart-empty .chart-empty-icon {
    display: block;
    margin-bottom: var(--space-2);
    opacity: 0.5;
}

.line-chart-empty .chart-empty-icon svg {
    width: 32px;
    height: 32px;
    color: var(--text-muted);
}

.line-chart-empty p {
    margin: 0;
}

/* Wyśrodkuj empty state w line-chart (który ma flex-end) */
.line-chart .line-chart-empty {
    align-self: center;
    width: 100%;
}

/* Responsive Stash */
@media (max-width: 900px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }

    .stash-controls {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: var(--space-3);
    }

    .stash-search {
        width: 100%;
    }

    .stash-search input {
        width: 100%;
    }

    .stash-sort {
        width: 100%;
    }

    .stash-sort-select {
        flex: 1;
    }

    .stash-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stash-stat-card {
        padding: var(--space-2) var(--space-3);
    }

    .stash-stat-value {
        font-size: 1.1rem;
    }

    .stash-stat-total {
        grid-column: span 2;
    }
}

@media (max-width: 480px) {
    .stash-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
    }

    .stash-stat-icon {
        width: 28px;
        height: 28px;
    }

    .stash-stat-icon svg {
        width: 16px;
        height: 16px;
    }

    .stash-stat-icon img {
        width: 20px;
        height: 20px;
    }
}
