:root {
  --red: #b3261e; --red-d: #8c1d17; --green: #1e8e3e; --green-d: #166c2f;
  --orange: #e37400; --gray: #80868b; --bg: #f4f1ec; --card: #fff; --text: #1f1f1f; --muted: #5f6368;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 16px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 18px 0 10px; }

/* Üst bar */
.topbar { display: flex; align-items: center; justify-content: space-between; background: var(--red); color: #fff;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 1000; }
.brand { font-weight: 700; font-size: 17px; line-height: 1.1; }
.brand small { display: block; font-weight: 400; font-size: 12px; opacity: .85; }
.top-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
button.link { background: none; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 14px; cursor: pointer; }
.conn { font-size: 14px; color: #ccc; }
.conn.ok { color: #7cf29c; } .conn.bad { color: #ffb4a9; }

/* Kartlar, formlar */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.center { text-align: center; }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.center-page .card { width: 100%; max-width: 400px; }
label { display: block; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
input { display: block; width: 100%; margin-top: 4px; padding: 12px; font-size: 16px; border: 1px solid #ccc; border-radius: 10px; background: #fff; }
input:focus { outline: 2px solid var(--red); border-color: transparent; }
.btn { display: inline-block; width: 100%; padding: 13px; border: 0; border-radius: 10px; background: var(--red); color: #fff;
  font-size: 16px; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none; margin-top: 6px; }
.btn:disabled { opacity: .6; }
.btn.secondary { background: #e8e3dc; color: var(--text); }
.btn.danger-outline { background: none; border: 1px solid var(--red); color: var(--red); margin-top: 14px; }
.btn.big { padding: 15px; font-size: 18px; }
.btn.huge { padding: 26px 10px; font-size: 22px; letter-spacing: .5px; border-radius: 16px; }
.btn.green { background: var(--green); } .btn.green:active { background: var(--green-d); }
.btn.red { background: var(--red); } .btn.red:active { background: var(--red-d); }
.row { display: flex; gap: 10px; } .row .btn { flex: 1; }

.alert { border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; font-size: 14px; line-height: 1.4; text-align: left; }
.alert.error { background: #fce8e6; color: #8c1d17; }
.alert.warn { background: #fef7e0; color: #7a4f01; }
.alert.ok { background: #e6f4ea; color: #0d652d; }

/* Kurye ekranı */
body.kurye main { padding: 16px; max-width: 520px; margin: 0 auto; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.hello { margin: 4px 0 14px; font-size: 17px; }
.status-title { font-size: 24px; font-weight: 800; color: var(--green); margin: 8px 0 2px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.stats div { background: #f6f6f6; border-radius: 10px; padding: 10px; text-align: left; }
.stats span { display: block; font-size: 12px; color: var(--muted); }
.stats b { font-size: 16px; }
.pulse { width: 22px; height: 22px; border-radius: 50%; background: var(--green); margin: 4px auto 0; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(30,142,62,.6); } 70% { box-shadow: 0 0 0 18px rgba(30,142,62,0); } 100% { box-shadow: 0 0 0 0 rgba(30,142,62,0); } }

/* Yönetim ekranı */
body.admin { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.layout { flex: 1; display: flex; min-height: 0; }
.list { width: 340px; overflow-y: auto; background: #fff; border-right: 1px solid #e0e0e0; }
#map { flex: 1; min-height: 0; }
.citem { padding: 12px 14px; border-bottom: 1px solid #eee; border-left: 4px solid transparent; cursor: pointer; }
.citem.sel { background: #fff6f5; border-left-color: var(--red); }
.citem.inactive { opacity: .55; }
.chead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cinfo { font-size: 13px; color: var(--muted); margin-top: 4px; }
.warnline { font-size: 13px; color: #8c4a00; background: #fef7e0; border-radius: 8px; padding: 6px 8px; margin-top: 6px; }
.cbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cbtns button { font-size: 13px; padding: 5px 9px; border-radius: 7px; border: 1px solid #ccc; background: #fafafa; cursor: pointer; }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 20px; color: #fff; white-space: nowrap; }
.badge.live { background: var(--green); } .badge.stale { background: var(--orange); } .badge.off { background: var(--gray); }

/* Harita işaretleri */
.cmark { position: relative; }
.cmark span { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: 13px; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); position: relative; z-index: 2; }
.cmark.live span { background: var(--green); } .cmark.stale span { background: var(--orange); } .cmark.off span { background: var(--gray); }
.cmark.sel span { outline: 3px solid var(--red); }
.cmark .dir { position: absolute; left: 50%; top: 50%; width: 0; height: 0; margin: -30px 0 0 -7px; z-index: 1;
  border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 12px solid #1a73e8;
  transform-origin: 7px 30px; }
.shop-icon { font-size: 22px; text-align: center; line-height: 28px; background: #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.modal .card { width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-top: 0; }

/* Telefon/tablet: harita üstte, liste altta */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  #map { flex: 1 1 60%; }
  .list { width: 100%; flex: 0 0 40%; border-right: 0; border-top: 1px solid #e0e0e0; }
  .top-actions button.link { padding: 5px 7px; font-size: 13px; }
}

.inline-input { display: flex; gap: 8px; align-items: stretch; margin-top: 4px; }
.inline-input input { margin-top: 0; flex: 1; }
.btn.small { width: auto; margin: 0; padding: 0 14px; font-size: 14px; }
code { background: #fff; padding: 1px 5px; border-radius: 5px; font-size: 13px; word-break: break-all; }
