:root {
    --brand: #6366f1;
    --brand-2: #8b5cf6;
    --brand-3: #ec4899;
    --ink: #0f172a;
    --muted: #64748b;
    --bg: #f1f5f9;
    --card: #ffffff;
    --ring: rgba(99, 102, 241, .35);
    --radius: 18px;
    --shadow: 0 10px 40px -12px rgba(15, 23, 42, .18);
}

* { box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* ===== Butonlar ===== */
.btn-gradient {
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 50%, var(--brand-3) 120%);
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 24px -8px var(--ring);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-gradient:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.05); box-shadow: 0 12px 28px -8px var(--ring); }
.btn-gradient:active { transform: translateY(0); }
.btn-gradient:disabled { opacity: .6; }
.btn-icon { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; }

/* ===== AUTH (login / register) ===== */
.auth-body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at -10% -10%, #ede9fe, transparent 60%),
        radial-gradient(900px 500px at 110% 110%, #fce7f3, transparent 55%),
        var(--bg);
}
.auth-shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
@media (min-width: 992px) { .auth-shell { grid-template-columns: 1.05fr .95fr; } }

.auth-brand {
    position: relative;
    overflow: hidden;
    color: #fff;
    padding: 3.5rem;
    background: linear-gradient(150deg, #4f46e5 0%, #7c3aed 45%, #db2777 110%);
    flex-direction: column;
    justify-content: center;
}
.auth-brand__inner { position: relative; z-index: 2; max-width: 460px; }
.auth-brand__glow {
    position: absolute; inset: 0;
    background:
        radial-gradient(400px 400px at 80% 10%, rgba(255,255,255,.18), transparent 60%),
        radial-gradient(500px 500px at 0% 100%, rgba(255,255,255,.12), transparent 55%);
}
.auth-brand__logo { display: flex; align-items: center; gap: .6rem; font-size: 1.35rem; font-weight: 700; margin-bottom: 3rem; }
.auth-brand__logo i { font-size: 1.6rem; }
.auth-brand__title { font-size: 2.4rem; font-weight: 800; line-height: 1.15; margin-bottom: 1.1rem; letter-spacing: -.02em; }
.auth-brand__lead { font-size: 1.05rem; opacity: .92; line-height: 1.6; margin-bottom: 2rem; }
.auth-brand__points { list-style: none; padding: 0; margin: 0 0 2.5rem; display: grid; gap: .85rem; }
.auth-brand__points li { display: flex; align-items: center; gap: .65rem; font-weight: 500; }
.auth-brand__points i { color: #a7f3d0; font-size: 1.15rem; }
.auth-brand__footer { font-size: .9rem; opacity: .8; border-top: 1px solid rgba(255,255,255,.2); padding-top: 1.25rem; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card__head { margin-bottom: 1.75rem; }
.auth-card__head h2 { font-weight: 800; letter-spacing: -.02em; margin-bottom: .35rem; }
.auth-card__logo { font-weight: 700; color: var(--brand); margin-bottom: 1.25rem; font-size: 1.15rem; }

.auth-form .form-control { border-radius: 12px; padding: 1rem .9rem; border-color: #e2e8f0; }
.auth-form .form-floating > label { color: var(--muted); }
.auth-form .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem var(--ring); }

.btn-toggle-pass {
    position: absolute; top: 50%; right: .75rem; transform: translateY(-50%);
    background: none; border: none; color: var(--muted); cursor: pointer; padding: .35rem; z-index: 5;
}
.btn-toggle-pass:hover { color: var(--brand); }

/* ===== APP LAYOUT (panel) ===== */
.app-body { margin: 0; background: var(--bg); min-height: 100vh; }
.app-layout { display: flex; min-height: 100vh; }

.app-sidebar {
    width: 260px; flex-shrink: 0; background: #fff; border-right: 1px solid #e9eef5;
    display: flex; flex-direction: column; padding: 1.25rem .9rem;
    position: fixed; inset: 0 auto 0 0; z-index: 1040; transition: transform .25s ease;
}
.app-sidebar--admin { background: #0f172a; border-color: #1e293b; }
.app-sidebar--admin .app-sidebar__brand,
.app-sidebar--admin .app-nav__link { color: #cbd5e1; }
.app-sidebar--admin .app-nav__link.active { background: rgba(99,102,241,.18); color: #fff; }
.app-sidebar--admin .app-nav__link:hover:not(.disabled) { background: rgba(255,255,255,.06); color: #fff; }

.app-sidebar__brand { display: flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.15rem; color: var(--brand); padding: .5rem .65rem 1.5rem; }
.app-nav { display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.app-nav__link {
    display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 12px;
    color: #475569; text-decoration: none; font-weight: 500; transition: background .15s, color .15s;
}
.app-nav__link i { font-size: 1.1rem; }
.app-nav__link:hover:not(.disabled) { background: #f1f5f9; color: var(--ink); }
.app-nav__link.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 16px -8px var(--ring); }
.app-nav__link.disabled { opacity: .55; cursor: default; pointer-events: none; }
.badge-soon { margin-left: auto; font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; background: #e2e8f0; color: #64748b; padding: .15rem .45rem; border-radius: 999px; }
.app-sidebar__foot { border-top: 1px solid #eef2f7; padding-top: .75rem; margin-top: .5rem; }
.app-sidebar--admin .app-sidebar__foot { border-color: #1e293b; }
.app-nav__tag { color: #64748b; font-size: .8rem; display: flex; align-items: center; gap: .4rem; padding: .5rem .65rem; }

.app-sidebar__backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1035; }
.app-sidebar__backdrop.show { display: block; }

.app-content { flex: 1; min-width: 0; margin-left: 260px; display: flex; flex-direction: column; }
.app-topbar {
    height: 68px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
    border-bottom: 1px solid #e9eef5; display: flex; align-items: center; gap: .75rem;
    padding: 0 1.25rem; position: sticky; top: 0; z-index: 1020;
}
.app-topbar__title { font-weight: 700; font-size: 1.05rem; }
.app-main { padding: 1.5rem; max-width: 1200px; width: 100%; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .app-content { margin-left: 0; }
}

/* User chip */
.user-chip { display: flex; align-items: center; gap: .55rem; background: #fff; border: 1px solid #e9eef5; border-radius: 999px; padding: .3rem .7rem .3rem .35rem; cursor: pointer; font-weight: 600; color: var(--ink); }
.user-chip:hover { border-color: var(--brand); }
.user-chip__avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.user-chip__avatar--admin { background: linear-gradient(135deg, #0f172a, #475569); }
.user-chip__name { font-size: .92rem; }

/* ===== Cards / stats ===== */
.welcome-hero { background: linear-gradient(135deg, #eef2ff, #fae8ff); border-radius: var(--radius); padding: 1.5rem 1.75rem; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); height: 100%; }
.stat-card__icon { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: .9rem; }
.stat-card__value { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-card__label { color: var(--muted); font-size: .85rem; margin-top: .25rem; }

.card { border-radius: var(--radius); }
.empty-illustration { width: 84px; height: 84px; border-radius: 50%; background: #eef2ff; color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 2.2rem; }

/* ===== Error pages ===== */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 2rem; }
.error-code { font-size: 6rem; font-weight: 900; line-height: 1; background: linear-gradient(135deg, var(--brand), var(--brand-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ===== Impersonate çubuğu ===== */
.impersonate-bar { background: #1e293b; color: #fff; border: none; }
.impersonate-bar .btn-light { font-weight: 600; }

/* ===== Entegrasyon kartları ===== */
.integration-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; height: 100%; display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease; }
.integration-card:hover { transform: translateY(-2px); box-shadow: 0 14px 44px -14px rgba(15,23,42,.22); }
.integration-card--soon { opacity: .72; }
.integration-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.integration-card__icon { width: 52px; height: 52px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.integration-card__title { font-size: 1.15rem; font-weight: 700; margin-bottom: .25rem; }
.integration-card__desc { color: var(--muted); font-size: .9rem; flex: 1; margin-bottom: 1rem; }

/* ===== WhatsApp gelen kutusu ===== */
.wa-layout { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; height: calc(100vh - 68px - 3rem); min-height: 480px; }
@media (max-width: 767.98px) { .wa-layout { grid-template-columns: 1fr; height: auto; } }

.wa-list { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.wa-list__head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem; font-weight: 700; border-bottom: 1px solid #eef2f7; }
.wa-test { padding: .75rem 1.1rem; border-bottom: 1px solid #eef2f7; }
.wa-contacts { overflow-y: auto; flex: 1; }
.wa-contact { display: flex; align-items: center; gap: .7rem; padding: .75rem 1.1rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid #f4f7fb; }
.wa-contact:hover { background: #f8fafc; }
.wa-contact.active { background: #eef2ff; }
.wa-contact__avatar { width: 42px; height: 42px; border-radius: 50%; background: #dcf8c6; color: #128c4a; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.wa-contact__body { display: flex; flex-direction: column; min-width: 0; }
.wa-contact__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-contact__last { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.wa-thread { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.wa-thread__head { display: flex; align-items: center; gap: .7rem; padding: .85rem 1.1rem; border-bottom: 1px solid #eef2f7; }
.wa-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: .75rem; padding: 3rem; }
.wa-empty i { font-size: 3rem; opacity: .4; }
.wa-messages { flex: 1; overflow-y: auto; padding: 1.25rem; background: #efeae2; display: flex; flex-direction: column; gap: .5rem; min-height: 240px; }
.wa-msg { display: flex; }
.wa-msg--out { justify-content: flex-end; }
.wa-msg__bubble { max-width: 75%; padding: .5rem .75rem; border-radius: 12px; background: #fff; box-shadow: 0 1px 1px rgba(0,0,0,.08); font-size: .94rem; position: relative; word-wrap: break-word; }
.wa-msg--out .wa-msg__bubble { background: #d9fdd3; }
.wa-msg__meta { display: block; text-align: right; font-size: .68rem; color: #667781; margin-top: .15rem; }
.wa-compose { display: flex; gap: .5rem; padding: .75rem 1rem; border-top: 1px solid #eef2f7; align-items: flex-end; }
.wa-compose textarea { resize: none; border-radius: 20px; max-height: 120px; }
.wa-compose__hint { font-size: .72rem; color: var(--muted); padding: 0 1rem .75rem; }
