* { box-sizing: border-box; }

body {
    font-family: var(--px-font, "Segoe UI", Arial, sans-serif);
    background: var(--px-bg, #f4f7fb);
    color: var(--px-text, #1f2a37);
    margin: 0;
}

.nav-badge {
    display: inline-block;
    margin-left: 0.35rem;
    min-width: 1.35rem;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
}

.nav-badge-empty { display: none; }

button,
.search-form button,
.filter-form button {
    background: var(--px-accent, #38BDF8);
    color: #041018;
    border: none;
    border-radius: var(--px-radius-sm, 8px);
    padding: 0.65rem 1.1rem;
    cursor: pointer;
    font-weight: 600;
}

.analysis-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.75rem 2rem 2.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.page-meta {
    color: #64748b;
    font-size: 0.92rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.clock { font-weight: 700; color: #1e293b; }

h1 { margin: 0 0 0.35rem; font-size: 1.75rem; }
h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.page-desc { color: #64748b; margin: 0; }

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-head h2 { margin: 0; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.08);
}

.stat-label {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.stat-blue .stat-value { color: #2563eb; }
.stat-green .stat-value { color: #16a34a; }
.stat-red .stat-value { color: #dc2626; }
.stat-critical .stat-value { color: #b91c1c; }
.stat-warning .stat-value { color: #b45309; }

.critical-stats .stat-critical { border-color: #fecaca; background: #fff7f7; }
.critical-stats .stat-warning { border-color: #fde68a; background: #fffbeb; }

.search-form,
.filter-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-form input,
.filter-grid input {
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    min-width: 220px;
}

.search-form input { flex: 1; }

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.filter-tab {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid #dbe3ee;
    background: #fff;
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
}

.filter-tab.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: 0.75rem;
    width: 100%;
}

.result-section { margin-bottom: 2.5rem; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.result-card {
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    padding: 1rem;
}

.card-title { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.5rem; }
.card-meta { color: #64748b; font-size: 0.92rem; margin-bottom: 0.25rem; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.badge-aktif { background: #dcfce7; color: #166534; }
.badge-pasif, .badge-serinoeksik, .badge-eslesmeeksik, .badge-heartbeatyok, .badge-uzunsurepasif { background: #fee2e2; color: #991b1b; }
.badge-vnc-aktif { background: #dcfce7; color: #166534; }
.badge-vnc-yok { background: #e2e8f0; color: #475569; }
.badge-vnc-bilinmiyor { background: #fef3c7; color: #92400e; }
.badge-log-alert { background: #fef3c7; color: #92400e; }
.badge-log-error { background: #fee2e2; color: #991b1b; }
.badge-log-update { background: #dbeafe; color: #1e40af; }
.badge-log-startup { background: #e0e7ff; color: #3730a3; }

.filter-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.filter-actions .btn-link { margin-top: 0; }

.btn-link {
    display: inline-block;
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

/* Global `button` rule paints solid primary blue; without this reset,
   button.btn-link gets blue text on blue bg (invisible label). */
button.btn-link {
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    color: #2563eb;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    line-height: inherit;
    vertical-align: baseline;
}

.btn-link:hover { text-decoration: underline; }
button.btn-link:hover { text-decoration: underline; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.data-table th,
.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    font-size: 0.92rem;
}

.data-table th {
    background: #f8fafc;
    color: #475569;
}

.table-wrap { overflow-x: auto; }

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-panel {
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    padding: 1.2rem;
}

.detail-panel.full-width { margin-bottom: 1.5rem; }

.detail-list {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0.6rem 1rem;
}

.detail-list dt { color: #64748b; font-weight: 600; }
.detail-list dd { margin: 0; }

.empty { color: #64748b; }

.badge-agent-guncel {
    background: #dcfce7;
    color: #166534;
}

.badge-agent-eski {
    background: #ffedd5;
    color: #9a3412;
}

.badge-agent-bilinmiyor {
    background: #f1f5f9;
    color: #64748b;
}

.alert-section { margin-top: 0.5rem; }

.conflict-block {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.conflict-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.conflict-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.alert-controls .mute-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
}

.version-ok { color: #166534; font-weight: 600; }
.version-old { color: #b45309; font-weight: 700; }
.version-unknown { color: #64748b; }

.pagination { margin-top: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.page-link {
    padding: 0.4rem 0.8rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    text-decoration: none;
    color: #1f2a37;
}
.page-link.active { background: #2563eb; color: #fff; border-color: #2563eb; }

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.75rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.alert-ok {
    background: #dcfce7;
    color: #166534;
    padding: 0.75rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stack-form label {
    font-weight: 600;
    margin-top: 0.5rem;
}

.stack-form input,
.stack-form select {
    padding: 0.7rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.stack-form button {
    margin-top: 1rem;
    align-self: flex-start;
}

.user-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form { display: inline; margin: 0; }

.link-button {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.link-button:hover { text-decoration: underline; }

.settings-form { max-width: 960px; }
.settings-form h2 { margin-bottom: 1rem; }
.settings-form button { margin-top: 0.5rem; }

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
}

.settings-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-weight: 600;
    color: #334155;
}

.settings-grid label.full { grid-column: 1 / -1; }

.settings-grid .hint {
    font-weight: 400;
    font-size: 0.85rem;
    color: #64748b;
}

.settings-grid input {
    padding: 0.7rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-weight: 400;
}

.settings-grid textarea {
    padding: 0.7rem 0.9rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-weight: 400;
    font-family: inherit;
    resize: vertical;
}

.envanter-filters {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem 1rem;
    margin: 0 0 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    align-items: end;
}

.envanter-filters.is-open {
    display: grid;
}

.envanter-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    margin: 0 0 0.85rem;
}

.envanter-quick input[type="search"] {
    flex: 1;
    min-width: 220px;
    padding: 0.65rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font: inherit;
}

.btn-secondary-outline {
    background: #fff !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}

.detail-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.85rem;
}

.detail-tab {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
    padding: 0.45rem 0.85rem !important;
}

.detail-tab.active {
    background: #eff6ff !important;
    color: #2563eb !important;
    border-color: #bfdbfe !important;
}

.detail-tab-link {
    margin-left: auto;
}

.detail-tab-panel[hidden] { display: none !important; }

.envanter-filters label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
}

.envanter-filters input,
.envanter-filters select {
    padding: 0.45rem 0.55rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-weight: 400;
    font-size: 0.9rem;
}

.envanter-filter-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.envanter-filter-actions button {
    margin-top: 0;
}

.row-actions,
.detail-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    line-height: 1.35;
}

.row-actions .inline-form,
.detail-actions .inline-form {
    display: inline;
    margin: 0;
}

.row-actions .btn-link,
.row-actions button.btn-link {
    white-space: nowrap;
}

.tutarsiz-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
}

button.btn-link.tutarsiz-primary {
    font-weight: 700;
}

.tutarsiz-disabled {
    display: block;
    max-width: 16rem;
    color: #64748b;
}

.audit-field-tabs {
    margin: 0.5rem 0 1rem;
}

.inline-form {
    display: inline;
    margin: 0;
}

.btn-danger-link {
    background: none;
    border: none;
    padding: 0;
    color: #b91c1c;
    font-weight: 600;
    cursor: pointer;
    font: inherit;
}

.btn-danger-link:hover {
    text-decoration: underline;
}

.btn-danger {
    background: #b91c1c !important;
    border-color: #991b1b !important;
    color: #fff !important;
}

.envanter-edit-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.envanter-edit-form {
    max-width: 1100px;
}

@media (max-width: 900px) {
    .detail-grid, .filter-grid, .stats-grid, .settings-grid { grid-template-columns: 1fr; }
    .analysis-main { padding: 1.25rem 1rem 2rem; }
}
