:root {
    --renk-ana: #4f46e5;
    --renk-ana-koyu: #4338ca;
    --renk-ana-acik: #eef2ff;
    --renk-ik: #0891b2;
    --renk-bg: #f3f4f6;
    --renk-kart: #ffffff;
    --renk-metin: #1f2937;
    --renk-soluk: #6b7280;
    --renk-cizgi: #e5e7eb;
    --renk-yesil: #16a34a;
    --renk-sari: #d97706;
    --renk-kirmizi: #dc2626;
    --golge: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --golge-buyuk: 0 10px 25px rgba(0,0,0,.1);
}

* { box-sizing: border-box; }

html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    background: var(--renk-bg);
    color: var(--renk-metin);
}

/* ---------- Kabuk / Header ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
    display: flex; align-items: center; gap: 1.5rem;
    padding: 0 1.5rem; height: 60px;
    background: var(--renk-kart);
    border-bottom: 1px solid var(--renk-cizgi);
    box-shadow: var(--golge);
    position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-size: 1.15rem; }
.brand-logo { font-size: 1.5rem; }
.brand-text b { color: var(--renk-ana); }
.app-nav { display: flex; gap: .5rem; margin-left: auto; }
.app-nav a {
    text-decoration: none; color: var(--renk-metin); padding: .4rem .85rem;
    border-radius: 8px; font-weight: 500; font-size: .95rem; transition: .15s;
}
.app-nav a:hover { background: var(--renk-ana-acik); color: var(--renk-ana); }
.app-user { display: flex; align-items: center; gap: .75rem; }
.user-chip {
    display: flex; flex-direction: column; line-height: 1.15; text-align: right;
    font-weight: 600; font-size: .9rem;
}
.user-chip small { font-weight: 400; color: var(--renk-soluk); font-size: .75rem; }
.user-chip.rol-ik { color: var(--renk-ik); }
.btn-cikis {
    border: 1px solid var(--renk-cizgi); background: #fff; color: var(--renk-soluk);
    padding: .35rem .8rem; border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.btn-cikis:hover { background: #fef2f2; color: var(--renk-kirmizi); border-color: #fecaca; }

.app-main { flex: 1; display: flex; flex-direction: column; }

/* ---------- Giriş ---------- */
.login-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; min-height: calc(100vh - 60px); }
.login-card {
    background: var(--renk-kart); border-radius: 20px; box-shadow: var(--golge-buyuk);
    padding: 2.5rem; width: 100%; max-width: 420px; text-align: center;
}
.login-logo { font-size: 3.5rem; }
.login-card h1 { font-size: 1.5rem; margin: .5rem 0; }
.login-sub { color: var(--renk-soluk); font-size: .95rem; margin-bottom: 1.5rem; }
.login-form { display: flex; flex-direction: column; gap: .5rem; text-align: left; }
.login-form label { font-size: .85rem; font-weight: 600; color: var(--renk-soluk); }
.login-input {
    padding: .75rem 1rem; border: 2px solid var(--renk-cizgi); border-radius: 12px;
    font-size: 1rem; outline: none; transition: .15s;
}
.login-input:focus { border-color: var(--renk-ana); }
.login-btn {
    margin-top: .5rem; padding: .8rem; border: none; border-radius: 12px;
    background: var(--renk-ana); color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer; transition: .15s;
}
.login-btn:hover:not(:disabled) { background: var(--renk-ana-koyu); }
.login-btn:disabled { opacity: .5; cursor: not-allowed; }
.login-error { color: var(--renk-kirmizi); font-size: .85rem; margin-top: .25rem; }
.login-demo { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--renk-cizgi); }
.login-demo > span { font-size: .8rem; color: var(--renk-soluk); }
.demo-chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .6rem; }
.demo-chips button {
    border: 1px solid var(--renk-cizgi); background: #fff; padding: .4rem .8rem;
    border-radius: 20px; font-size: .82rem; cursor: pointer; transition: .15s;
}
.demo-chips button:hover { border-color: var(--renk-ana); color: var(--renk-ana); }
.demo-chips .chip-ik:hover { border-color: var(--renk-ik); color: var(--renk-ik); }

/* ---------- Sohbet ---------- */
.chat-page { flex: 1; display: flex; justify-content: center; padding: 1.5rem; }
.chat-window {
    width: 100%; max-width: 760px; display: flex; flex-direction: column;
    background: var(--renk-kart); border-radius: 16px; box-shadow: var(--golge-buyuk);
    overflow: hidden; height: calc(100vh - 60px - 3rem);
}
.chat-messages { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.msg { display: flex; gap: .6rem; max-width: 85%; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-bot { align-self: flex-start; }
.msg-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: var(--renk-ana-acik);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.msg-bubble { padding: .7rem 1rem; border-radius: 14px; line-height: 1.5; font-size: .95rem; }
.msg-bot .msg-bubble { background: var(--renk-ana-acik); color: var(--renk-metin); border-bottom-left-radius: 4px; }
.msg-user .msg-bubble { background: var(--renk-ana); color: #fff; border-bottom-right-radius: 4px; }
.typing { display: flex; gap: 4px; align-items: center; }
.typing span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--renk-ana);
    opacity: .4; animation: blink 1.2s infinite both;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }

.chat-suggestions-bar {
    display: flex; align-items: center; gap: .6rem;
    padding: .6rem 1.5rem; border-top: 1px solid var(--renk-cizgi); background: #fafafe;
}
.suggestions-label {
    font-size: .72rem; font-weight: 700; color: var(--renk-soluk); text-transform: uppercase;
    letter-spacing: .03em; white-space: nowrap; flex-shrink: 0;
}
.chat-suggestions {
    display: flex; gap: .5rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin;
}
.chat-suggestions button {
    border: 1px solid var(--renk-cizgi); background: #fff; padding: .45rem .85rem;
    border-radius: 20px; font-size: .82rem; cursor: pointer; transition: .15s;
    white-space: nowrap; flex-shrink: 0;
}
.chat-suggestions button:hover:not(:disabled) { border-color: var(--renk-ana); color: var(--renk-ana); background: var(--renk-ana-acik); }
.chat-suggestions button:disabled { opacity: .5; cursor: not-allowed; }
.chat-suggestions::-webkit-scrollbar { height: 6px; }
.chat-suggestions::-webkit-scrollbar-thumb { background: var(--renk-cizgi); border-radius: 3px; }

.chat-input { display: flex; gap: .6rem; padding: 1rem 1.5rem; border-top: 1px solid var(--renk-cizgi); }
.chat-input input {
    flex: 1; padding: .75rem 1rem; border: 2px solid var(--renk-cizgi);
    border-radius: 24px; font-size: .95rem; outline: none; transition: .15s;
}
.chat-input input:focus { border-color: var(--renk-ana); }
.chat-input button {
    padding: .75rem 1.5rem; border: none; border-radius: 24px; background: var(--renk-ana);
    color: #fff; font-weight: 600; cursor: pointer; transition: .15s;
}
.chat-input button:hover:not(:disabled) { background: var(--renk-ana-koyu); }
.chat-input button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- İK Paneli ---------- */
.ik-page { flex: 1; padding: 1.5rem; max-width: 1100px; margin: 0 auto; width: 100%; }
.ik-title { font-size: 1.5rem; margin-bottom: 1.25rem; }
.ik-loading { color: var(--renk-soluk); }
.ik-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.ik-card {
    background: var(--renk-kart); border-radius: 14px; padding: 1.25rem; box-shadow: var(--golge);
    display: flex; flex-direction: column; gap: .25rem;
}
.ik-card-warn { border-left: 4px solid var(--renk-sari); }
.ik-num { font-size: 2rem; font-weight: 700; color: var(--renk-ana); }
.ik-label { font-size: .85rem; color: var(--renk-soluk); }

.ik-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.ik-panel { background: var(--renk-kart); border-radius: 14px; padding: 1.25rem; box-shadow: var(--golge); }
.ik-panel h2 { font-size: 1.05rem; margin: 0 0 1rem; }
.ik-empty { color: var(--renk-soluk); font-size: .9rem; }

.talep-row {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: .8rem 0; border-bottom: 1px solid var(--renk-cizgi);
}
.talep-row:last-child { border-bottom: none; }
.talep-bilgi { display: flex; flex-direction: column; gap: .15rem; }
.talep-bilgi span { font-size: .85rem; color: var(--renk-soluk); }
.talep-bilgi small { font-size: .8rem; color: var(--renk-soluk); font-style: italic; }
.talep-aksiyon { display: flex; gap: .4rem; }
.btn-onay, .btn-red { border: none; padding: .4rem .8rem; border-radius: 8px; cursor: pointer; font-size: .82rem; font-weight: 600; }
.btn-onay { background: #dcfce7; color: var(--renk-yesil); }
.btn-onay:hover { background: var(--renk-yesil); color: #fff; }
.btn-red { background: #fee2e2; color: var(--renk-kirmizi); }
.btn-red:hover { background: var(--renk-kirmizi); color: #fff; }

.uyari-row { display: flex; gap: .6rem; padding: .7rem 0; border-bottom: 1px solid var(--renk-cizgi); }
.uyari-row:last-child { border-bottom: none; }
.uyari-row > div { display: flex; flex-direction: column; gap: .15rem; }
.uyari-row span { font-size: .85rem; color: var(--renk-soluk); }
.uyari-nokta { width: 10px; height: 10px; border-radius: 50%; margin-top: .3rem; flex-shrink: 0; }
.uyari-kritik .uyari-nokta { background: var(--renk-kirmizi); }
.uyari-uyari .uyari-nokta { background: var(--renk-sari); }
.uyari-bilgi .uyari-nokta { background: var(--renk-ik); }

.dagilim-row { display: flex; align-items: center; gap: .75rem; padding: .4rem 0; }
.dagilim-ad { width: 130px; font-size: .85rem; flex-shrink: 0; }
.dagilim-bar-bg { flex: 1; height: 10px; background: var(--renk-cizgi); border-radius: 5px; overflow: hidden; }
.dagilim-bar { height: 100%; background: var(--renk-ana); border-radius: 5px; transition: width .3s; }
.dagilim-sayi { width: 28px; text-align: right; font-weight: 700; font-size: .85rem; color: var(--renk-ana); }

/* Veri kaynağı şeridi (SAP + Meyer) */
.kaynak-strip { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.kaynak-badge {
    display: inline-flex; align-items: center; gap: .35rem; background: #fff; border: 1px solid var(--renk-cizgi);
    padding: .35rem .7rem; border-radius: 8px; font-size: .85rem; font-weight: 600; box-shadow: var(--golge);
}
.kaynak-badge small { font-weight: 400; color: var(--renk-soluk); }
.kaynak-canli { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--renk-yesil); font-weight: 600; }
.canli-nokta { width: 8px; height: 8px; border-radius: 50%; background: var(--renk-yesil); animation: nabiz 1.5s infinite; }
@keyframes nabiz { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.ik-card-canli { border-left: 4px solid var(--renk-yesil); }
.ik-card-canli .ik-num { color: var(--renk-yesil); }

/* PDKS bölümü */
.pdks-alt { margin-bottom: 1rem; }
.pdks-alt h3 { font-size: .9rem; margin: .5rem 0 .5rem; color: var(--renk-metin); }
.pdks-row { display: flex; justify-content: space-between; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--renk-cizgi); font-size: .88rem; }
.pdks-row:last-child { border-bottom: none; }
.pdks-row small { color: var(--renk-soluk); }
.pdks-gec { color: var(--renk-sari); font-weight: 600; font-size: .82rem; }
.pdks-yok { color: var(--renk-kirmizi); font-weight: 600; font-size: .82rem; }
.pdks-anomali { margin-top: .5rem; padding: .6rem .8rem; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; font-size: .85rem; color: #92400e; }

.sap-toast {
    background: #dcfce7; border: 1px solid #86efac; color: #166534; padding: .7rem 1rem;
    border-radius: 10px; font-size: .9rem; font-weight: 600; margin-bottom: 1rem;
}

.ik-panel-brifing { background: linear-gradient(135deg, #eef2ff, #fff); }
.brifing-not { font-size: .78rem; color: var(--renk-soluk); margin: 0 0 .6rem; }
.brifing-metin {
    white-space: pre-wrap; font-family: 'Segoe UI', sans-serif; font-size: .85rem; line-height: 1.5;
    background: #fff; border: 1px solid var(--renk-cizgi); border-radius: 10px; padding: .9rem; margin: 0;
}

@media (max-width: 760px) {
    .ik-grid { grid-template-columns: 1fr; }
    .app-nav { gap: .2rem; }
    .user-chip { display: none; }
}

/* ---------- Blazor hata bileşeni ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: .6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary {
    background: #b32121; padding: 1rem; color: white;
}
.blazor-error-boundary::after { content: "Bir hata oluştu."; }
