/* 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); }

/* 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; }

/* 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; }

/* 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; }

/* ===================== 07. faz — Takvim (planlama) + Bugun ===================== */

/* 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); }

/* Plan butonlari (basliktaki) */
.planbtn { border: none; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700;
           padding: 6px 12px; border-radius: 18px; cursor: pointer; }
.planbtn:active { transform: scale(.97); }

/* Hafta gezinme satiri */
.hafta-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
             font-size: 12.5px; font-weight: 700; color: var(--navy); }
.hafta-nav a { flex: 0 0 38px; text-align: center; text-decoration: none; color: var(--accent);
               font-size: 18px; font-weight: 800; background: #fff; border: 1px solid var(--line);
               border-radius: 10px; padding: 3px 0; }

/* Haftalik serit (Pzt–Paz) */
.week { display: flex; gap: 6px; margin-bottom: 12px; }
.day  { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 11px;
        padding: 9px 4px; text-align: center; cursor: pointer; }
.day.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.day.today { border-color: var(--accent); }
.day.disabled { opacity: .4; cursor: default; }
.day .d { font-size: 10px; opacity: .8; }
.day .n { font-size: 16px; font-weight: 700; margin-top: 1px; }
.day .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin: 4px auto 0; }
.day.on .dot { background: #fff; }

/* Plan satirlari: dashed mavi = planlandi, yesil = yapildi */
.planrow { background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--accent);
           border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px;
           display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.planrow.plan { border-left-style: dashed; }
.planrow.done { border-left-color: var(--green); border-left-style: solid; opacity: .78; }
.planrow .tm  { font-size: 11px; color: var(--muted); white-space: nowrap; }
.planrow .pad { font-size: 11px; color: var(--muted); margin-top: 2px; }
.planrow .pill { font-size: 10px; font-weight: 700; color: var(--accent); background: #e9f2ff;
                 padding: 2px 7px; border-radius: 10px; margin-left: 6px; }
.plansil { border: none; background: #fdecec; color: var(--red); font-size: 11px; font-weight: 700;
           width: 24px; height: 24px; border-radius: 50%; cursor: pointer; flex: 0 0 auto; }

/* Planlama modali gun secici (hafta seridini yeniden kullanir) */
.pweek { margin-bottom: 2px; }

/* Bugun kartlari: yapilan / geciken vurgusu */
.firma.yapildi { opacity: .72; }
.firma.yapildi .ic { background: #e2f5ec; }
.firma.gecmis .ic  { background: #fff7ed; }
.gec-bilgi { font-size: 11.5px; color: var(--muted); margin: -4px 2px 10px; }

/* ===================== 08. faz — Rota (anlik geocode + sirali rota) ===================== */

/* Adim kartlari */
.rcard { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 13px 14px; margin-bottom: 11px; }
.rcard h2 { margin: 0 0 9px; font-size: 13.5px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.stepn { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff;
         font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.stepn.done { background: var(--green); }

/* Butonlar */
.rbtn { border: none; border-radius: 10px; padding: 10px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.rbtn:active { transform: scale(.98); }
.rbtn.primary { background: var(--accent); color: #fff; }
.rbtn.green   { background: var(--green); color: #fff; }
.rbtn.ghost   { background: #fff; border: 1px solid var(--line); color: var(--navy); }
.rbtn.mini    { padding: 6px 11px; font-size: 11.5px; }
.rbtn:disabled { opacity: .45; cursor: default; transform: none; }
.rrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Baslangic kutusu */
.startbox { border: 1.5px dashed var(--line); border-radius: 11px; padding: 11px; margin-top: 9px; }
.startbox.confirmed { border-style: solid; border-color: var(--green); background: #f3fbf7; }
.startbox .bt { font-size: 12.5px; font-weight: 700; }
.startbox .coord { font-size: 11px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.startbox iframe { width: 100%; height: 200px; border: 0; border-radius: 10px; margin-top: 9px; }

/* Durak secimi */
.rsec { display: flex; gap: 9px; align-items: flex-start; background: #fff; border: 1px solid var(--line);
        border-radius: 11px; padding: 10px 11px; margin-bottom: 7px; cursor: pointer; }
.rsec input { margin-top: 3px; flex: 0 0 auto; }
.rsec .ad { font-size: 12.5px; font-weight: 600; }
.rsec .ax { font-size: 11px; color: var(--muted); margin-top: 2px; }
.rsec.gec { border-left: 3px solid var(--amber); }

/* Uyari / bilgi kutulari */
.rerr { background: #fdecec; border: 1px solid #f3bcbc; color: #a12; border-radius: 10px;
        padding: 9px 11px; font-size: 12px; margin-top: 9px; line-height: 1.45; }
.rok  { background: #e2f5ec; border: 1px solid #a8e0c4; color: #0b6b48; border-radius: 10px;
        padding: 9px 11px; font-size: 12px; margin-top: 9px; }
.rhint { font-size: 11px; color: var(--muted); margin-top: 7px; line-height: 1.5; }

/* Rota listesi */
.route-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.route-row:last-child { border-bottom: none; }
.seqn { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff;
        font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.seqn.start { background: var(--green); }
.seqn.end   { background: var(--amber); color: #3a2c00; }
.seqn.pasif { background: #cbd5e1; }
.route-row .mid { flex: 1; min-width: 0; }
.route-row .ad  { font-size: 12.5px; font-weight: 600; }
.route-row .leg { font-size: 11px; color: var(--muted); margin-top: 2px; }
.route-row .eta { flex: 0 0 auto; font-size: 11.5px; font-weight: 700; color: var(--accent); }
.route-row.pasif { opacity: .6; }
.route-row.pasif .ad { text-decoration: line-through; }
.rpill { display: inline-block; background: #eef2f6; border-radius: 6px; padding: 1px 7px;
         font-size: 10.5px; color: var(--navy); font-weight: 700; }

/* Harita */
#rmap { width: 100%; height: 300px; border-radius: 11px; border: 1px solid var(--line); background: #dfe6ee; display: none; }
#rmap.on { display: block; }

/* Saat/servis girdileri */
.rin { width: 74px; border: 1px solid var(--line); border-radius: 9px; padding: 8px; font-size: 13px;
       font-family: inherit; text-align: center; background: #fff; }

/* ===================== 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; }

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