:root {
    --amber:     #f5a623;
    --amber-2:   #ffc451;
    --amber-d:   #e0930c;
    --ink:       #1c1d22;
    --text:      #20222a;
    --muted:     #7b8190;
    --line:      #e7eaf0;
    --bg:        #ffffff;
    --soft:      #f6f8fb;
    --error-bg:  #fef2f2;
    --error-bd:  #fecaca;
    --error-tx:  #c0392b;
    --radius:    22px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ======================= GİRİŞ EKRANI ======================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(800px 500px at 88% 8%, rgba(245,166,35,.12), transparent 60%),
        radial-gradient(700px 500px at 5% 95%, rgba(245,166,35,.10), transparent 60%),
        #ffffff;
}

/* ---- Arka plan ışıltıları ---- */
.bg-orbs { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.orb {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5;
    animation: drift 16s ease-in-out infinite;
}
.orb-1 { width: 420px; height: 420px; top: -140px; right: -80px;
         background: radial-gradient(circle, rgba(245,166,35,.40), transparent 70%); }
.orb-2 { width: 380px; height: 380px; bottom: -150px; left: -90px;
         background: radial-gradient(circle, rgba(255,196,81,.35), transparent 70%); animation-delay: -5s; }
.orb-3 { width: 280px; height: 280px; top: 55%; left: 60%;
         background: radial-gradient(circle, rgba(245,166,35,.16), transparent 70%); animation-delay: -9s; }
@keyframes drift {
    0%,100% { transform: translate(0,0) scale(1); }
    33%     { transform: translate(40px,-30px) scale(1.08); }
    66%     { transform: translate(-30px,25px) scale(.95); }
}
.grid-overlay {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(20,30,50,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20,30,50,.035) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 72%);
}

/* ---- Kart ---- */
.auth { position: relative; z-index: 1; width: 100%; max-width: 900px; }
.auth-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(28,40,64,.14), 0 4px 14px rgba(28,40,64,.06);
    animation: rise .55s cubic-bezier(.2,.7,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(22px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---- Sol marka paneli (renkli amber) ---- */
.auth-brand {
    position: relative;
    padding: 50px 40px;
    display: flex; flex-direction: column; justify-content: center;
    color: #fff;
    background:
        radial-gradient(500px 300px at 25% 10%, rgba(255,255,255,.22), transparent 55%),
        linear-gradient(150deg, #ffb43d 0%, #f5a623 45%, #e07d0b 100%);
    overflow: hidden;
}
.brand-inner { position: relative; z-index: 2; }
.brand-glow {
    position: absolute; width: 280px; height: 280px; border-radius: 50%;
    bottom: -100px; right: -70px; filter: blur(50px);
    background: radial-gradient(circle, rgba(255,255,255,.35), transparent 70%);
    animation: drift 12s ease-in-out infinite;
}

/* Büyüteç tarama animasyonu */
.scan { position: relative; width: 116px; height: 116px; margin-bottom: 30px; color: #fff; }
.scan-glass {
    width: 116px; height: 116px;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,.18));
    animation: sweep 5s ease-in-out infinite; transform-origin: 50% 50%;
}
@keyframes sweep {
    0%,100% { transform: translate(-6px,-4px) rotate(-8deg); }
    50%     { transform: translate(8px,6px) rotate(8deg); }
}
.scan-lines { position: absolute; top: 28px; left: 4px; width: 66px; }
.scan-lines span {
    display: block; height: 5px; border-radius: 4px; margin-bottom: 8px;
    background: linear-gradient(90deg, rgba(255,255,255,.95), rgba(255,255,255,0));
    animation: pulseLine 2.2s ease-in-out infinite;
}
.scan-lines span:nth-child(1){ width: 60%; animation-delay: 0s; }
.scan-lines span:nth-child(2){ width: 80%; animation-delay: .2s; }
.scan-lines span:nth-child(3){ width: 45%; animation-delay: .4s; }
.scan-lines span:nth-child(4){ width: 70%; animation-delay: .6s; }
.scan-lines span:nth-child(5){ width: 55%; animation-delay: .8s; }
@keyframes pulseLine { 0%,100%{ opacity:.3; } 50%{ opacity:1; } }

.brand-tag { font-size: 30px; font-weight: 800; line-height: 1.12; letter-spacing: -.5px; color: #fff; }
.brand-text { color: rgba(255,255,255,.92); font-size: 14px; line-height: 1.6; margin-top: 14px; max-width: 300px; }

.brand-feats { list-style: none; margin-top: 26px; display: flex; flex-direction: column; gap: 13px; }
.brand-feats li {
    display: flex; align-items: center; gap: 12px;
    font-size: 13.5px; font-weight: 500; color: #fff; max-width: 300px;
}
.brand-feats li svg {
    width: 19px; height: 19px; flex: none;
    padding: 8px; box-sizing: content-box;
    background: rgba(255,255,255,.18); border-radius: 10px;
    backdrop-filter: blur(4px);
}

/* ---- Sağ form paneli ---- */
.auth-form { padding: 50px 44px; display: flex; flex-direction: column; background: #fff; }
.form-logo { margin-bottom: 28px; }
.form-logo img { height: 38px; width: auto; display: block; }

.form-title { font-size: 23px; font-weight: 700; letter-spacing: -.3px; color: var(--ink); }
.form-sub { color: var(--muted); font-size: 14px; margin: 6px 0 26px; }

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: #4a4f5b; margin-bottom: 7px; }
.field-input {
    position: relative; display: flex; align-items: center;
    background: var(--soft); border: 1.5px solid var(--line); border-radius: 13px;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.field-input svg { width: 18px; height: 18px; color: var(--muted); margin: 0 0 0 14px; flex: none; transition: color .18s; }
.field-input input,
.field-input textarea {
    width: 100%; padding: 13px 14px; font-size: 15px; font-family: inherit;
    color: var(--text); background: transparent; border: none; outline: none;
}
.field-input textarea { resize: vertical; line-height: 1.55; min-height: 389px; max-height: 520px; }
.field-input input::placeholder,
.field-input textarea::placeholder { color: #aab0bd; }
.field-input:focus-within {
    border-color: var(--amber); background: #fff;
    box-shadow: 0 0 0 4px rgba(245,166,35,.15);
}
.field-input:focus-within svg { color: var(--amber-d); }

.pw-toggle { background: none; border: none; cursor: pointer; color: var(--muted); padding: 0 14px; display: flex; align-items: center; }
.pw-toggle svg { margin: 0; width: 19px; height: 19px; }
.pw-toggle:hover, .pw-toggle.on { color: var(--amber-d); }

.btn-primary {
    margin-top: 10px;
    display: flex; align-items: center; justify-content: center; gap: 9px;
    width: 100%; padding: 14px; font-size: 15px; font-weight: 600; font-family: inherit;
    color: #fff; cursor: pointer; border: none; border-radius: 13px;
    background: linear-gradient(135deg, var(--amber-2) 0%, var(--amber) 50%, var(--amber-d) 100%);
    box-shadow: 0 10px 24px rgba(245,166,35,.32);
    transition: transform .08s, box-shadow .18s, filter .18s;
}
.btn-primary svg { width: 19px; height: 19px; transition: transform .18s; }
.btn-primary:hover { box-shadow: 0 14px 32px rgba(245,166,35,.45); filter: brightness(1.04); }
.btn-primary:hover svg { transform: translateX(3px); }
.btn-primary:active { transform: translateY(1px); }

.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: 12px; font-size: 13.5px; margin-bottom: 20px;
}
.alert svg { flex: none; }
.alert-error { background: var(--error-bg); border: 1px solid var(--error-bd); color: var(--error-tx); }

.form-foot { text-align: center; color: #9aa0ad; font-size: 11.5px; margin-top: 26px; }

/* ---- Mobil ---- */
@media (max-width: 720px) {
    .auth-card { grid-template-columns: 1fr; max-width: 430px; }
    .auth-brand { display: none; }
    .auth-form { padding: 42px 30px; }
}

/* ======================= PANEL LAYOUT ======================= */
body { background: var(--soft); }
.layout { display: flex; min-height: 100vh; }

/* Sol menü */
.sidebar {
    width: 250px; flex: none; background: #fff; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; padding: 22px 16px;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-logo { padding: 6px 10px 22px; }
.sidebar-logo img { height: 30px; display: block; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link, .nav-logout {
    display: flex; align-items: center; gap: 12px; text-decoration: none;
    padding: 11px 13px; border-radius: 11px; font-size: 14.5px; font-weight: 500;
    color: #5b6270; transition: background .15s, color .15s;
}
.nav-link svg, .nav-logout svg { width: 19px; height: 19px; flex: none; }
.nav-link:hover { background: var(--soft); color: var(--ink); }
.nav-link.active {
    background: linear-gradient(135deg, rgba(245,166,35,.16), rgba(245,166,35,.08));
    color: var(--amber-d); font-weight: 600;
}
.nav-logout { color: var(--error-tx); margin-top: 8px; }
.nav-logout:hover { background: var(--error-bg); }

/* Ana alan */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.page-top {
    height: 70px; flex: none; background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
    position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--ink); }
.who { display: flex; align-items: center; gap: 10px; }
.who-badge {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--amber-2), var(--amber-d)); color: #fff; font-weight: 700; font-size: 14px;
}
.who-name { font-size: 14px; font-weight: 500; color: var(--text); }
.page-body { padding: 28px; }

/* Paneller / kartlar */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; box-shadow: 0 4px 16px rgba(28,40,64,.04); }
.panel + .panel { margin-top: 22px; }
.panel-title { font-size: 17px; font-weight: 700; color: var(--ink); }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.muted { color: var(--muted); font-size: 14px; }
.muted a { color: var(--amber-d); font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 22px; align-items: start; }

/* İstatistik kartları */
.stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; margin-bottom: 22px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: 0 4px 16px rgba(28,40,64,.04); }
.stat-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.stat-ico svg { width: 23px; height: 23px; }
.ico-amber { background: rgba(245,166,35,.14); color: var(--amber-d); }
.ico-green { background: rgba(34,197,94,.14); color: #16a34a; }
.ico-blue  { background: rgba(59,130,246,.14); color: #2563eb; }
.stat-num { font-size: 24px; font-weight: 800; color: var(--ink); line-height: 1; }
.stat-lbl { font-size: 13px; color: var(--muted); margin-top: 5px; }

/* Tablo */
.count-pill { font-size: 12.5px; font-weight: 600; color: var(--amber-d); background: rgba(245,166,35,.12); padding: 5px 12px; border-radius: 20px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 0 12px 12px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 14px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.person { display: flex; align-items: center; gap: 12px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg,#ffd27f,#f5a623); color: #5a3c05; font-weight: 700; font-size: 15px; flex: none; }
.p-name { font-weight: 600; color: var(--ink); }
.p-role { font-size: 12.5px; color: var(--muted); }

.wa-badge { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 20px; display: inline-flex; align-items: center; gap: 6px; }
.wa-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.wa-ok   { color: #16a34a; background: rgba(34,197,94,.12); }
.wa-warn { color: #d97706; background: rgba(245,166,35,.14); }
.wa-off  { color: #9aa0ad; background: #f1f3f7; }

.row-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.btn-wa {
    display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
    font-size: 13px; font-weight: 600; color: #fff; padding: 9px 13px; border-radius: 10px;
    background: linear-gradient(135deg,#25d366,#128c4b); box-shadow: 0 6px 16px rgba(37,211,102,.3); transition: filter .15s;
}
.btn-wa svg { width: 16px; height: 16px; }
.btn-wa:hover { filter: brightness(1.05); }
.btn-del { background: var(--error-bg); border: 1px solid var(--error-bd); color: var(--error-tx); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.btn-del svg { width: 16px; height: 16px; }
.btn-del:hover { background: #fde2e2; }
.row-actions form { margin: 0; }

.flash { padding: 12px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 20px; font-weight: 500; }
.flash-ok  { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.3); color: #15803d; }
.flash-err { background: var(--error-bg); border: 1px solid var(--error-bd); color: var(--error-tx); }

.form .field { margin-bottom: 14px; }

/* ---- WhatsApp bağlama ekranı ---- */
.back-link { display: inline-block; margin-bottom: 16px; color: var(--amber-d); font-weight: 600; font-size: 14px; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.wa-connect { display: grid; grid-template-columns: 1fr 380px; gap: 22px; align-items: stretch; }
.person.big .avatar { width: 50px; height: 50px; font-size: 19px; }
.person.big .p-name { font-size: 17px; }
.wa-steps { margin: 22px 0; padding-left: 20px; color: #4a4f5b; }
.wa-steps li { margin-bottom: 11px; font-size: 14.5px; line-height: 1.5; }
.wa-status-box { display: flex; align-items: center; gap: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; font-size: 14px; font-weight: 500; }
.wa-dot { width: 11px; height: 11px; border-radius: 50%; background: #cbd2dd; flex: none; }
.wa-dot.wa-baglaniyor { background: #f5a623; box-shadow: 0 0 0 4px rgba(245,166,35,.2); animation: blink 1.2s infinite; }
.wa-dot.wa-bagli { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.2); }
.wa-dot.wa-off { background: #cbd2dd; }
@keyframes blink { 50% { opacity: .35; } }
.btn-ghost-red { margin-top: 16px; display: inline-flex; align-items: center; gap: 8px; background: var(--error-bg); color: var(--error-tx); border: 1px solid var(--error-bd); padding: 10px 16px; border-radius: 11px; font-weight: 600; font-size: 14px; cursor: pointer; }
.btn-ghost-red:hover { background: #fde2e2; }

.wa-right { display: grid; place-items: center; }
.qr-area { width: 100%; min-height: 320px; display: grid; place-items: center; text-align: center; }
.qr-img { width: 280px; height: 280px; border-radius: 14px; border: 8px solid #fff; box-shadow: 0 8px 26px rgba(28,40,64,.12); }
.qr-hint { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.qr-loading p { margin-top: 14px; color: var(--muted); font-size: 14px; }
.spinner { width: 38px; height: 38px; border: 4px solid var(--line); border-top-color: var(--amber); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.qr-done { text-align: center; }
.qr-done .check { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 50%; background: #22c55e; color: #fff; font-size: 40px; display: grid; place-items: center; box-shadow: 0 8px 22px rgba(34,197,94,.35); }
.qr-done p { font-weight: 700; color: var(--ink); font-size: 16px; }
.qr-done .phone { color: var(--muted); font-size: 14px; }
.qr-err { text-align: center; font-size: 34px; }
.qr-err p { font-size: 14px; color: var(--error-tx); margin-top: 10px; font-weight: 500; }

@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr; }
    .wa-connect { grid-template-columns: 1fr; }
    .sidebar { width: 76px; }
    .sidebar .nav-link span, .sidebar .nav-logout span { display: none; }
    .sidebar-logo img { height: 24px; }
}
