:root {
    --bg: #f4f6fb;
    --sidebar-bg: #1a1735;
    --sidebar-text: #b8b4d9;
    --sidebar-active: #4b3f91;
    --primary: #5b4bc4;
    --primary-dark: #473a9e;
    --danger: #dc3545;
    --success: #198754;
    --warning: #d39e00;
    --card-bg: #fff;
    --text: #23212f;
    --muted: #6b6f82;
    --border: #e3e6f0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .5px;
}

.sidebar .brand .dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #b39d4f;
    box-shadow: 0 0 10px #d4b968;
}

.sidebar .nav-group {
    padding: 0;
    margin: 4px 0 12px;
    list-style: none;
}

.sidebar .nav-label {
    padding: 8px 18px 4px;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #6f6a9e;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8.5px 18px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar a.active { background: var(--sidebar-active); color: #fff; border-left-color: #b39d4f; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar .page-title { font-size: 18px; font-weight: 700; margin: 0; }
.topbar .user-box { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }

.content { padding: 22px 24px; flex: 1; }

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 18px;
}

.card h3 { margin: 0 0 12px; font-size: 15px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1100px) {
    .grid.cols-4, .grid.cols-6 { grid-template-columns: repeat(2, 1fr); }
    .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .grid { grid-template-columns: 1fr !important; }
}

.stat {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
}
.stat .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat .hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

table.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.table th, .table td {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}

.table th {
    background: #f0f2f8;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
}

.table tr:hover td { background: #f8f9fd; }

.badge {
    display: inline-block;
    padding: 2.5px 9px;
    font-size: 11.5px;
    border-radius: 999px;
    font-weight: 600;
    background: #e7e9f5; color: #444;
}
.badge.success { background: #d8f1e3; color: #0c5c36; }
.badge.danger { background: #f8dcdf; color: #8a1620; }
.badge.warning { background: #fdeec9; color: #7a5d00; }
.badge.info { background: #dcebfb; color: #0b4f80; }
.badge.muted { background: #ececec; color: #666; }

.btn {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 7px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: #f4f5fa; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }

form.inline { display: inline; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px; }
.form-control, textarea.form-control, select.form-control {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13.5px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
.form-control:focus { outline: 2px solid #c9c1f0; border-color: var(--primary); }
textarea { min-height: 90px; resize: vertical; }
.help-text { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.form-check input[type=checkbox] { width: 16px; height: 16px; }

.alert { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: #d8f1e3; color: #0c5c36; }
.alert-danger { background: #f8dcdf; color: #8a1620; }

.filters-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
}
.filters-bar input, .filters-bar select { min-width: 160px; }

.pagination-wrap { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.pagination { display: flex; gap: 4px; list-style: none; padding: 0; margin: 0; }
.pagination a, .pagination span {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(1200px 500px at 20% -10%, #3b3380 0%, #191632 60%);
}
.login-card {
    width: 380px;
    background: #fff;
    border-radius: 14px;
    padding: 34px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 13px; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-header h2 { margin: 0; font-size: 20px; }

.actions-cell { white-space: nowrap; }
.actions-cell form { display: inline; }

pre.code-block {
    background: #14121f;
    color: #d5e2f0;
    padding: 14px;
    border-radius: 8px;
    font-size: 12px;
    overflow: auto;
    max-height: 520px;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-line { font-family: Consolas, monospace; font-size: 12px; padding: 2px 0; border-bottom: 1px solid #f0f0f5; word-break: break-word; }
.log-line.error { color: #b3261e; }
.log-line.warning { color: #946200; }

.detail-list { list-style: none; padding: 0; margin: 0; }
.detail-list li { display: flex; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.detail-list li strong { width: 190px; flex-shrink: 0; color: var(--muted); font-weight: 600; }

.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 12px; margin-bottom: 10px; font-size: 13.5px; }
.chat-bubble.user { background: #e7ebff; margin-left: auto; }
.chat-bubble.assistant { background: #f1f2f6; }
.chat-bubble.system { background: #fff3cd; font-size: 12.5px; }
.chat-bubble .meta { font-size: 11px; color: var(--muted); margin-top: 4px; }

.prompt-editor { font-family: Consolas, monospace; font-size: 12.5px; min-height: 260px; }

.permission-group { margin-bottom: 14px; }
.permission-group h4 { margin: 0 0 8px; font-size: 13px; color: var(--primary); }
.permission-items { display: flex; flex-wrap: wrap; gap: 8px; }
.permission-item {
    display: flex; align-items: center; gap: 6px;
    background: #f4f5fa; border: 1px solid var(--border);
    padding: 5px 10px; border-radius: 7px; font-size: 12.5px;
}

.test-result { background: #14121f; color: #c7f0d4; padding: 16px; border-radius: 8px; font-family: Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; }

.mt-1 { margin-top: 10px; } .mt-2 { margin-top: 20px; } .mb-1 { margin-bottom: 10px; }
.text-muted { color: var(--muted); } .text-danger { color: var(--danger); }
.small { font-size: 12px; }
.flex-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   Faz 6: Dashboard / Analytics / Health / Alerts / Charts
   ============================================================ */

/* ---- KPI kartı + değişim göstergesi ---- */
.kpi-card .delta { font-size: 12.5px; font-weight: 700; margin-top: 3px; }
.kpi-card .delta-up { color: #198754; }
.kpi-card .delta-down { color: #dc3545; }
.kpi-card .delta-none { color: var(--muted); font-weight: 500; }
.kpi-card .delta-detail { font-weight: 500; color: var(--muted); font-size: 11px; }

/* ---- Tarih filtresi ---- */
.date-filter { padding: 12px 16px; }
.custom-range-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.custom-range-form input[type=date] { width: 150px; }
.custom-range-form label { margin: 0; }

/* ---- Saf CSS bar chart ---- */
.chart-card { min-width: 0; }
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 190px;
    padding: 8px 0 4px;
    overflow-x: auto;
}
.bar-col {
    flex: 1;
    min-width: 18px;
    max-width: 48px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    position: relative;
}
.bar {
    width: 100%;
    background: linear-gradient(180deg, #6c5ce0 0%, var(--primary) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    position: relative;
}
.bar-secondary {
    background: #f0c94f;
    opacity: .85;
    margin-top: 2px;
}
.bar-value { font-size: 9.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.bar-label { font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.chart-legend { margin: 10px 0 0; }
.legend-dot, .legend-dot.secondary {
    display: inline-block; width: 10px; height: 10px; border-radius: 3px;
    background: var(--primary); margin-right: 3px; vertical-align: middle;
}
.legend-dot.secondary { background: #f0c94f; }

/* ---- Progress bar ---- */
.progress-bar {
    display: block; width: 100%; height: 8px; background: #eef0f6;
    border-radius: 5px; overflow: hidden; margin: 4px 0;
}
.progress-bar span { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.progress-bar.warning span { background: var(--warning); }
.progress-bar.danger span { background: var(--danger); }
.progress-bar.budget span { background: linear-gradient(90deg, #198754, #5b4bc4); }
.progress-bar.budget.warning span { background: linear-gradient(90deg, #d39e00, #e8890c); }
.progress-bar.budget.danger span { background: linear-gradient(90deg, #dc3545, #a71d2a); }
.budget-value { font-size: 20px; font-weight: 700; margin: 6px 0 4px; }

/* ---- Karşılaştırma satırları (fal türleri) ---- */
.comparison-row {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.comparison-label { width: 150px; flex-shrink: 0; }
.comparison-row .progress-bar { flex: 1; margin: 0; }
.comparison-value { width: 130px; text-align: right; color: var(--muted); font-size: 12px; }

/* ---- Health paneli ---- */
.health-summary { border-left: 4px solid var(--success); }
.health-pill {
    display: inline-block; padding: 3px 12px; border-radius: 6px;
    font-size: 12.5px; font-weight: 700; letter-spacing: .5px;
}
.health-pill.healthy { background: #d8f1e3; color: #0c5c36; }
.health-pill.warning { background: #fdeec9; color: #7a5d00; }
.health-pill.error { background: #f8dcdf; color: #8a1620; }
.health-card.healthy { border-top: 3px solid var(--success); }
.health-card.warning { border-top: 3px solid var(--warning); }
.health-card.error { border-top: 3px solid var(--danger); }
.health-card .detail-list li { font-size: 12.5px; padding: 5px 0; }
.health-card .detail-list li strong { width: 130px; }
.health-message { margin: 8px 0 0; padding: 8px 10px; border-radius: 6px; }
.health-message.warning { background: #fdeec9; color: #7a5d00; }
.health-message.error { background: #f8dcdf; color: #8a1620; }
.health-mini .value { font-size: 18px; }

/* ---- Uyarı paneli ---- */
.alert-panel { border-left: 4px solid var(--danger); }
.report-card {
    background: #f8f9fd; border: 1px solid var(--border); border-radius: 8px;
    padding: 14px 16px;
}

/* ---- Sekmeler (kullanıcı detay) ---- */
.tab-nav {
    display: flex; gap: 4px; flex-wrap: wrap;
    border-bottom: 2px solid var(--border); margin-bottom: 14px;
}
.tab-link {
    padding: 8px 14px; font-size: 13px; font-weight: 600;
    color: var(--muted); text-decoration: none;
    border: 1px solid transparent; border-bottom: none;
    border-radius: 7px 7px 0 0;
}
.tab-link:hover { color: var(--text); text-decoration: none; background: #f4f5fa; }
.tab-link.active {
    color: var(--primary); background: var(--card-bg);
    border-color: var(--border); border-bottom: 2px solid var(--card-bg);
    margin-bottom: -2px;
}

/* ---- Global arama (topbar) ---- */
.topbar .global-search { display: flex; gap: 8px; align-items: center; }
.global-search input {
    width: 260px; padding: 6px 11px; border: 1px solid var(--border);
    border-radius: 7px; font-size: 13px;
}
@media (max-width: 1100px) {
    .global-search input { width: 170px; }
    .comparison-label { width: 110px; }
}
@media (max-width: 720px) {
    .global-search input { width: 120px; }
    .bar-chart { height: 140px; }
    .custom-range-form input[type=date] { width: 130px; }
}

