* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: #1a1d24;
    color: #d8d8d8;
    padding: 16px;
}
header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #ffcc44;
    padding-bottom: 8px;
    margin-bottom: 16px;
}
h1 { color: #ffcc44; font-size: 24px; }
#stats-bar { font-size: 14px; color: #aaa; }
#stats-bar span { color: #ffcc44; font-weight: bold; }

#filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    background: #252932;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}
#filters label { display: flex; align-items: center; gap: 4px; }
#filters input, #filters select {
    background: #1a1d24;
    color: #d8d8d8;
    border: 1px solid #444;
    padding: 4px 6px;
    border-radius: 4px;
}
#filters button {
    background: #ffcc44;
    color: #1a1d24;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}
#filters button:hover { background: #ffdd66; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th {
    text-align: left;
    padding: 8px;
    background: #252932;
    border-bottom: 2px solid #ffcc44;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th:hover { color: #ffcc44; }
th.num, td.num { text-align: right; }
td {
    padding: 6px 8px;
    border-bottom: 1px solid #2a2e38;
}
tbody tr:hover { background: #252932; }
td.item-name {
    color: #ffcc44;
    cursor: pointer;
    font-weight: 500;
}
td.item-name:hover { text-decoration: underline; }
.loading { text-align: center; color: #666; padding: 30px; }

/* Kalite renkleri */
.q-1 { color: #ccc; }
.q-2 { color: #4caf50; }
.q-3 { color: #2196f3; }
.q-4 { color: #9c27b0; }
.q-5 { color: #ff9800; font-weight: bold; }

/* Marj renkleri */
.margin-high { color: #4caf50; font-weight: bold; }
.margin-mid  { color: #ffc107; }
.margin-low  { color: #999; }

/* Age renkleri */
.age-fresh { color: #4caf50; }
.age-mid   { color: #ffc107; }
.age-old   { color: #ff5722; }

#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffcc44;
    color: #1a1d24;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}
#toast.show { opacity: 1; }

/* Item cell & icon */
td.item-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
td.item-cell:hover .item-name { text-decoration: underline; }
.item-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: #0f1116;
    border: 1px solid #333;
    flex-shrink: 0;
}
.item-name {
    color: #ffcc44;
    font-weight: 500;
}
.quality-cell { white-space: nowrap; font-weight: 500; }
.item-icon {
    width: 24px;
    height: 24px;
}

/* Chart modal */
.chart-col { text-align: center; width: 70px; }
.chart-cell { text-align: center; }
.chart-btn {
    background: #252932;
    color: #ffcc44;
    border: 1px solid #333;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}
.chart-btn:hover {
    background: #ffcc44;
    color: #1a1d24;
    border-color: #ffcc44;
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}
.modal-content {
    background: #1a1d24;
    border: 1px solid #333;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid #2a2e38;
}
.modal-header h2 {
    color: #ffcc44;
    font-size: 18px;
    margin: 0;
    font-weight: 600;
}
.modal-subtitle {
    color: #888;
    font-size: 13px;
    margin-top: 4px;
}
.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}
.modal-close:hover { color: #ffcc44; }

.chart-controls {
    display: flex;
    gap: 8px;
    padding: 12px 20px 0;
}
.range-btn {
    background: #252932;
    color: #d8d8d8;
    border: 1px solid #333;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.range-btn:hover { border-color: #ffcc44; color: #ffcc44; }
.range-btn.active {
    background: #ffcc44;
    color: #1a1d24;
    border-color: #ffcc44;
    font-weight: bold;
}

.chart-wrapper {
    padding: 16px 20px;
    flex: 1;
    min-height: 350px;
    position: relative;
}
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #2a2e38;
    color: #888;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 600px) {
    .modal-content { max-height: 95vh; }
    .chart-wrapper { min-height: 250px; padding: 8px; }
    .modal-header h2 { font-size: 15px; }
    .chart-controls { padding: 8px 12px 0; }
}

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.control-label {
    color: #888;
    font-size: 12px;
    margin-right: 4px;
}
.quality-btn {
    background: #252932;
    color: #d8d8d8;
    border: 1px solid #333;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.quality-btn:hover { border-color: #ffcc44; color: #ffcc44; }
.quality-btn.active {
    background: #ffcc44;
    color: #1a1d24;
    border-color: #ffcc44;
    font-weight: bold;
}
.chart-controls {
    flex-wrap: wrap;
    gap: 16px;
}

/* ============================================================
   NAVIGASYON
   ============================================================ */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #252932;
    padding: 10px 20px;
    border-radius: 6px;
    margin-bottom: 16px;
    border-bottom: 2px solid #ffcc44;
}
.nav-brand {
    color: #ffcc44;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 0.5px;
}
.nav-links { display: flex; gap: 8px; }
.nav-link {
    color: #d8d8d8;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.15s;
}
.nav-link:hover { background: #1a1d24; color: #ffcc44; }
.nav-link.active {
    background: #ffcc44;
    color: #1a1d24;
    font-weight: bold;
}
.nav-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   PRICE CHECKER
   ============================================================ */
.pc-main {
    max-width: 1000px;
    margin: 0 auto;
}
.pc-search-wrapper {
    position: relative;
    margin-bottom: 20px;
}
#pc-search {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    background: #252932;
    color: #d8d8d8;
    border: 2px solid #333;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s;
}
#pc-search:focus { border-color: #ffcc44; }

.pc-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1d24;
    border: 1px solid #333;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}
.pc-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #252932;
}
.pc-result-item:hover { background: #252932; }
.pc-result-name { color: #ffcc44; flex: 1; font-size: 14px; }
.pc-result-id { color: #666; font-size: 11px; font-family: monospace; }
.pc-result-empty { padding: 14px; text-align: center; color: #666; }

.pc-detail {
    background: #1a1d24;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
}
.pc-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #2a2e38;
}
.pc-icon { width: 48px; height: 48px; border-radius: 6px; background: #0f1116; border: 1px solid #333; }
.pc-header h2 { color: #ffcc44; font-size: 20px; margin: 0; }
.pc-subtitle { color: #666; font-size: 13px; font-family: monospace; margin-top: 4px; }
.pc-close {
    margin-left: auto;
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.pc-close:hover { color: #ffcc44; }

.pc-quality-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.pc-table th {
    background: #252932;
    padding: 10px;
    text-align: left;
    color: #d8d8d8;
    border-bottom: 2px solid #ffcc44;
    cursor: default;
}
.pc-table th.num { text-align: right; }
.pc-table td {
    padding: 10px;
    border-bottom: 1px solid #2a2e38;
}
.pc-table td.num { text-align: right; }
.pc-age { color: #666; font-size: 11px; margin-left: 6px; }
.pc-empty { color: #555; font-style: italic; }
.pc-empty-row td { padding: 6px 10px; }

.pc-chart-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

.pc-tier-badge {
    background: #ffcc44;
    color: #1a1d24;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
    font-family: monospace;
}

.quality-btn.disabled {
    opacity: 0.25;
    cursor: not-allowed;
}
.quality-btn.disabled:hover {
    border-color: #333;
    color: #d8d8d8;
}

/* ============================================================
   REFINE CALCULATOR
   ============================================================ */
.refine-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    background: #252932;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #333;
}
.refine-controls label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #888;
    font-size: 12px;
}
.refine-controls select,
.refine-controls input[type="number"] {
    background: #1a1d24;
    color: #d8d8d8;
    border: 1px solid #444;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 13px;
    min-width: 100px;
}
.refine-controls input[type="number"]:focus,
.refine-controls select:focus {
    outline: none;
    border-color: #ffcc44;
}
.toggle-label {
    flex-direction: row !important;
    align-items: center;
    gap: 6px !important;
    color: #d8d8d8 !important;
    font-size: 13px !important;
    cursor: pointer;
}
.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #ffcc44;
    cursor: pointer;
}
#ref-calculate {
    background: #ffcc44;
    color: #1a1d24;
    border: none;
    padding: 10px 24px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    align-self: flex-end;
}
#ref-calculate:hover { background: #ffdd66; }

.ref-result {
    background: #1a1d24;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
}
.ref-result h2 {
    color: #ffcc44;
    font-size: 18px;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #2a2e38;
    font-family: monospace;
}
.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.ref-card {
    background: #252932;
    padding: 14px;
    border-radius: 6px;
    border: 1px solid #2a2e38;
}
.ref-card.highlight {
    background: #2a2418;
    border-color: #ffcc44;
}
.ref-label {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.ref-value {
    color: #d8d8d8;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Segoe UI', sans-serif;
}
.ref-card.highlight .ref-value { color: #ffcc44; }
.ref-details {
    display: flex;
    gap: 20px;
    padding-top: 12px;
    border-top: 1px solid #2a2e38;
    color: #888;
    font-size: 12px;
    font-family: monospace;
}
.ref-details span { color: #d8d8d8; }

/* ============================================================
   REFINE — YENİ
   ============================================================ */
.refine-main { max-width: 1400px; margin: 0 auto; }
.refine-filters {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    background: #252932;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid #333;
}
.filter-group { display: flex; align-items: center; gap: 6px; }
.toggle-btn {
    background: #1a1d24;
    color: #666;
    border: 1px solid #333;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}
.toggle-btn:hover { border-color: #ffcc44; color: #ffcc44; }
.toggle-btn.active {
    background: #ffcc44;
    color: #1a1d24;
    border-color: #ffcc44;
    font-weight: bold;
}

.refine-table-wrap {
    overflow-x: auto;
    background: #1a1d24;
    border: 1px solid #333;
    border-radius: 8px;
    margin-bottom: 16px;
}
.refine-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 1000px;
}
.refine-table th {
    background: #252932;
    padding: 10px 8px;
    text-align: left;
    color: #d8d8d8;
    border-bottom: 2px solid #ffcc44;
    font-size: 12px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.refine-table th.num { text-align: right; }
.refine-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #2a2e38;
    vertical-align: middle;
}
.refine-table td.num { text-align: right; }
.refine-table tr:hover { background: #252932; }
.ref-item-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.ref-item-name {
    color: #d8d8d8;
    font-size: 13px;
}
.price-input {
    background: #0f1116;
    color: #ffcc44;
    border: 1px solid #333;
    padding: 4px 6px;
    border-radius: 3px;
    width: 80px;
    text-align: right;
    font-size: 13px;
    font-family: 'Segoe UI', sans-serif;
}
.price-input:focus {
    outline: none;
    border-color: #ffcc44;
    box-shadow: 0 0 0 1px rgba(255, 204, 68, 0.3);
}
.profit-pos { color: #4caf50; }
.profit-neg { color: #ff5722; }

.ref-summary {
    background: #252932;
    padding: 14px 20px;
    border-radius: 6px;
    border-left: 4px solid #ffcc44;
    font-size: 14px;
    color: #d8d8d8;
}
.ref-summary b { color: #ffcc44; }

.refine-table .item-icon {
    width: 32px;
    height: 32px;
}
.refine-table td {
    padding: 10px 8px;
}
.price-input {
    width: 90px;
    padding: 6px 8px;
    font-size: 14px;
}