/* Saha mobil — ortak renk paleti (prototipten) */
:root {
    --navy: #16314f;
    --accent: #2f80ed;
    --accent2: #56ccf2;
    --green: #1e9e6a;
    --red: #d64545;
    --amber: #e0a800;
    --blue: #1c6dd0;
    --ink: #22303f;
    --muted: #7b8794;
    --bg: #e7ecf1;
    --line: #e6ebf0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* Mobil cerceve — masaustunde ortalanmis dar kolon */
.phone {
    width: 100%;
    max-width: 430px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.appbar {
    background: linear-gradient(120deg, var(--navy), #22507f);
    color: #fff;
    padding: 30px 16px 14px;
}
.appbar-title { font-size: 20px; font-weight: 700; }
.appbar-sub   { font-size: 11px; opacity: .8; margin-top: 2px; }
.appbar-row   { display: flex; justify-content: space-between; align-items: flex-start; }
.appbar-cikis {
    background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.4);
    border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer;
}

/* Mobil giris */
.login { padding: 26px 18px; }
.login h1 { font-size: 20px; color: var(--navy); margin: 6px 0 18px; }
.login label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.login input[type=text], .login input[type=password] {
    width: 100%; padding: 12px; font-size: 15px; border: 1.5px solid var(--line); border-radius: 11px;
}
.login .check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); margin-top: 14px; }
.login .check input { width: auto; }
.login button {
    width: 100%; margin-top: 18px; padding: 13px; font-size: 15px; font-weight: 700;
    background: var(--accent); color: #fff; border: none; border-radius: 11px; cursor: pointer;
}
.login-hata { color: var(--red); font-size: 13px; margin-bottom: 6px; }
.login-hata ul { margin: 0; padding-left: 18px; }

.content {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
}

/* Alt sekme bari */
.tabbar {
    display: flex;
    border-top: 1px solid var(--line);
    background: #fff;
    position: sticky;
    bottom: 0;
}
.tab {
    flex: 1;
    padding: 9px 0 11px;
    text-align: center;
    color: var(--muted);
    font-size: 18px;
    text-decoration: none;
    line-height: 1.1;
}
.tab span { display: block; font-size: 10.5px; margin-top: 3px; }
.tab.on { color: var(--accent); font-weight: 700; }

/* Bos sayfa yer tutucusu */
.placeholder {
    text-align: center;
    padding: 48px 18px;
    color: var(--muted);
}
.placeholder h1 { font-size: 20px; color: var(--navy); margin: 8px 0 6px; }
.placeholder p  { font-size: 13px; }
.ph-emoji { font-size: 44px; }
.ph-faz {
    display: inline-block;
    margin-top: 10px;
    font-size: 11px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 3px 12px;
    color: var(--navy);
}
.ph-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

/* ===================== 06. faz — Firmalarim + ziyaret gunlugu ===================== */

/* Baslik satiri */
.h { font-size: 14px; font-weight: 700; color: var(--navy); margin: 2px 2px 10px;
     display: flex; justify-content: space-between; align-items: center; }
.h small { font-weight: 500; color: var(--muted); font-size: 11px; }

/* Filtre kutusu */
.filtre { margin-bottom: 12px; }
.filtre-ara { width: 100%; padding: 11px 12px; font-size: 14px; border: 1.5px solid var(--line);
              border-radius: 11px; background: #fff; }
.filtre-satir { display: flex; gap: 8px; margin-top: 8px; }
.filtre-sel { flex: 1; min-width: 0; padding: 9px 10px; font-size: 13px; border: 1px solid var(--line);
              border-radius: 10px; background: #fff; color: var(--ink); }

/* Sayfalama (Firmalarim) */
.pager { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.pager .pg-btn { padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--navy);
                 border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.pager .pg-btn:active { transform: scale(.99); background: #f1f7ff; }
.pager .pg-btn:disabled { opacity: .45; cursor: default; }
.pager .pg-bilgi { flex: 1; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pager .pg-boyut { flex: 0 0 auto; width: auto; }

/* Firma karti */
.firma { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px;
         margin-bottom: 9px; display: flex; align-items: center; gap: 11px; cursor: pointer; transition: .12s; }
.firma:active { transform: scale(.99); background: #f0f4f8; }
.firma .ic { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px; background: #eef3f8;
             display: flex; align-items: center; justify-content: center; font-size: 17px; }
.firma .mid { flex: 1; min-width: 0; }
.firma .ad { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.firma .sub { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Kart detay satirlari: adres, yetkili rozetleri, firma telefonu — sarabilir (mobilde okunsun/aranisin).
   Temel stil global (modaldeki klon da kullanir); kart ici ust bosluk ayri. */
.firma-detay { font-size: 11px; color: var(--muted); line-height: 1.35; word-break: break-word; }
.firma .firma-detay { margin-top: 3px; }

/* Yetkili rozetleri (kart + modal): her yetkili AYRI badge, telefonu tiklanabilir (tel:) */
.firma-yetkililer { display: flex; flex-wrap: wrap; gap: 5px; }
.yk-badge { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; max-width: 100%;
            background: #eef3f8; border: 1px solid #dde7f0; border-radius: 999px;
            padding: 3px 10px; font-size: 11px; line-height: 1.3; }
.yk-badge::before { content: "👤"; font-size: 10px; opacity: .8; }
.yk-ad { font-weight: 700; color: var(--ink); }
.yk-tel, .tel-link { color: #1f8a4c; font-weight: 600; text-decoration: none; white-space: nowrap; }
.yk-tel:active, .tel-link:active { opacity: .55; }
.firma-tel .tel-link + .tel-link { margin-left: 8px; }

/* Modal: yetkili + iletisim bolumu (adres yok) */
.m-firmabilgi { display: grid; gap: 10px; margin: 2px 0 13px; padding: 11px 12px;
                background: #f7fafc; border: 1px solid var(--line); border-radius: 11px; }
.mfb-bas { font-size: 11px; font-weight: 700; color: var(--navy); text-transform: uppercase;
           letter-spacing: .3px; margin-bottom: 6px; }

/* Durum chip */
.chip { font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.c-gray  { background: #eceff3; color: #5b6b7b; }
.c-blue  { background: #e3effd; color: var(--blue); }
.c-green { background: #e2f5ec; color: var(--green); }
.c-red   { background: #fdecec; color: var(--red); }

/* Bottom-sheet modal */
.modal { position: fixed; inset: 0; background: rgba(10,25,45,.45); display: none;
         align-items: flex-end; justify-content: center; z-index: 50; }
.modal.on { display: flex; }
.sheet { background: #fff; width: 100%; max-width: 430px; border-radius: 18px 18px 0 0;
         padding: 16px 16px 22px; max-height: 92vh; overflow-y: auto; animation: sheetUp .25s; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet h3 { margin: 2px 0 3px; font-size: 16px; color: var(--navy); }
.sheet .sub { font-size: 11.5px; color: var(--muted); margin-bottom: 13px; }
.newvisit { font-size: 12px; font-weight: 700; color: var(--navy); margin: 4px 2px 8px; }
.opts { display: grid; gap: 8px; margin-bottom: 6px; }
.opt { padding: 12px 13px; border: 1.5px solid var(--line); border-radius: 11px; font-size: 13.5px;
       font-weight: 600; cursor: pointer; }
.opt:active { transform: scale(.99); }
.opt.sel { border-color: var(--accent); background: #f1f7ff; }
.iki { display: flex; gap: 10px; margin-top: 6px; }
.iki > div { flex: 1; min-width: 0; }
.fld { display: block; font-size: 11.5px; font-weight: 700; color: var(--navy); margin: 10px 2px 6px; }
.selbox { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
          font-family: inherit; font-size: 13.5px; color: var(--ink); background: #fff; }
.sheet textarea { width: 100%; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px;
                  padding: 9px; font-family: inherit; font-size: 13px; min-height: 52px; resize: none; }
.m-hata { color: var(--red); font-size: 12.5px; margin: 8px 2px 0; min-height: 1px; }
.sheet .save { width: 100%; margin-top: 12px; padding: 13px; border: none; border-radius: 11px;
               background: var(--navy); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.sheet .save:disabled { opacity: .6; cursor: default; }

/* Belge fotografi: kamera/galeri secimi + onizleme */
.fotobtns { display: flex; gap: 8px; }
.fotobtn { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
           font-family: inherit; font-size: 13px; font-weight: 600; color: var(--navy);
           background: #fff; cursor: pointer; }
.fotobtn:active { transform: scale(.99); background: #f1f7ff; }
.fotoprev { position: relative; margin-top: 10px; }
.fotoprev img { width: 100%; max-height: 220px; object-fit: contain; border: 1px solid var(--line);
                border-radius: 10px; background: #f5f8fb; }
.fotodel { position: absolute; top: 6px; right: 6px; border: none; border-radius: 9px;
           background: rgba(16,49,79,.82); color: #fff; font-size: 11.5px; font-weight: 700;
           padding: 5px 9px; cursor: pointer; }

/* Kamera alt düğme çubuğu (canlı kamera overlay'inde kullanılır) */
.bt-bar { display: flex; gap: 6px; padding: 10px; background: #0a1626; flex-wrap: wrap;
          justify-content: center; }
.bt-btn { border: 1px solid rgba(255,255,255,.25); border-radius: 10px; background: #16314f; color: #fff;
          font-family: inherit; font-size: 13px; font-weight: 600; padding: 11px 13px; cursor: pointer; }
.bt-btn:active { transform: scale(.98); }
.bt-btn:disabled { opacity: .5; }
.bt-btn.bt-apply { background: var(--green, #1f9d57); flex: 1; min-width: 110px; }
.bt-btn.bt-cancel { background: transparent; }

/* Canlı kamera (çerçeve/referans) */
.bt-cam-overlay { position: fixed; inset: 0; background: #000; display: none; flex-direction: column; z-index: 85; }
.bt-cam-overlay.on { display: flex; }
.bt-cam-stage { flex: 1; position: relative; overflow: hidden; }
.bt-cam-stage video { width: 100%; height: 100%; object-fit: cover; background: #000; display: block; }
.bt-cam-guide { position: absolute; top: 9%; bottom: 13%; left: 7%; right: 7%;
                border: 2px dashed rgba(255,255,255,.92); border-radius: 12px;
                box-shadow: 0 0 0 100vmax rgba(0,0,0,.32); pointer-events: none; }
.bt-cam-hint { position: absolute; left: 0; right: 0; bottom: 3.5%; text-align: center; color: #fff;
               font-size: 13px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.85); pointer-events: none; }

/* Ziyaret gunlugu (cok kayitli gecmis) */
.vlog { background: #f5f8fb; border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; margin-bottom: 14px; }
.vt { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.vrow { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; border-top: 1px dashed #dde4ec; }
.vrow:first-of-type { border-top: none; }
.vd { flex: 0 0 50px; color: var(--muted); font-size: 11px; padding-top: 1px; }
.vmid { flex: 1; min-width: 0; }
.vnote { font-size: 12px; color: var(--ink); margin-top: 3px; }
.vfoto { font-size: 11px; color: var(--accent); text-decoration: none; display: inline-block; margin-top: 3px; }
.vempty, .vyukle { font-size: 12px; color: var(--muted); text-align: center; padding: 6px 0; }
.minichip { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 12px; white-space: nowrap; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%); background: #16314f; color: #fff;
         font-size: 12.5px; line-height: 1.4; padding: 10px 15px; border-radius: 14px; opacity: 0; transition: .3s;
         pointer-events: none; z-index: 60; max-width: 88%; text-align: center; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
.toast.on { opacity: 1; }

/* ===================== Bugun (genel durum + bugunku ziyaretler) ===================== */
/* rev02 Faz 06 (T10): Takvim/planlama soküldü — ilgili stiller (week/day/planrow/...) kaldirildi. */

/* Gun ozeti kutulari (Bugun) */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 14px; }
.stat  { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 11px 8px; text-align: center; }
.stat .v { font-size: 21px; font-weight: 800; }
.stat .l { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.stat.green .v { color: var(--green); }
.stat.red .v   { color: var(--red); }
.stat.gray .v  { color: var(--muted); }

/* Bilgi/aciklama satiri (Bugun genel durum altinda) */
.gec-bilgi { font-size: 11.5px; color: var(--muted); margin: -4px 2px 10px; }

/* ===================== 09. faz — Canli (cetele + siralama cubuklari) ===================== */

/* biz/karsi split bar */
.split { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin: 0 0 14px;
         font-size: 11px; font-weight: 700; color: #fff; }
.split .b { background: var(--green); display: flex; align-items: center; justify-content: center; min-width: 0; }
.split .k { background: var(--red);   display: flex; align-items: center; justify-content: center; min-width: 0; }

/* Siralama cubuklari (kapsam-bazli — prototip buildBars) */
.race { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 12px; margin-bottom: 12px; }
.race .t { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 10px; }
.bar { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 12px; }
.bar:last-child { margin-bottom: 0; }
.bar .nm { flex: 0 0 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .track { flex: 1; height: 14px; background: #eef2f6; border-radius: 8px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.bar.me .nm { font-weight: 700; color: var(--accent); }
.bar.low .fill { background: linear-gradient(90deg, #e0823f, #e9a96a); }
.bar .pct { flex: 0 0 auto; font-weight: 700; font-size: 11.5px; }
/* rev01 Faz 06: 1. sorumlu gorunumunde alt-ekip baslik satiri */
.race-grp { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
            letter-spacing: .4px; margin: 10px 0 6px; padding-top: 8px; border-top: 1px dashed var(--line); }
.race-grp:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.canli-foot { text-align: center; font-size: 11px; color: var(--muted); margin: 4px 0 0; }
