:root {
  --navy: #0b2545; --navy2: #13315c; --gold: #d4a017; --gold-d: #a87f0c;
  --bg: #f3f5f9; --card: #fff; --line: #dde3ee; --text: #17233a; --mute: #5d6b85;
  --ok: #1f8a4c; --warn: #c77700; --bad: #c0392b; --info: #2563b0;
  --r: 12px; --tab-h: 62px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--info); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 22px 0 10px; color: var(--navy); }
.boot { padding: 40px; text-align: center; color: var(--mute); }

/* Yerleşim */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; flex: 1; min-width: 0; }
.topbar .brand img { width: 30px; height: 30px; border-radius: 8px; }
.topbar .who { font-size: 13px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.icon-btn { background: transparent; border: 0; color: #fff; font-size: 20px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.icon-btn:active { background: rgba(255,255,255,.15); }

.side { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line);
  display: flex;
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--mute); font-size: 11px; }
.tabbar a .ic { font-size: 21px; line-height: 1; }
.tabbar a.on { color: var(--navy); font-weight: 700; }
.tabbar a.on .ic { color: var(--gold-d); }
.main { padding: 16px 14px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); max-width: 1280px; margin: 0 auto; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .side {
    display: flex; flex-direction: column; gap: 2px; position: fixed; top: 0; bottom: 0; left: 0; width: 220px;
    background: var(--navy); padding: 70px 10px 14px; z-index: 10;
  }
  .side a { color: #cdd7ea; padding: 11px 14px; border-radius: 10px; display: flex; gap: 12px; align-items: center; }
  .side a:hover { background: var(--navy2); }
  .side a.on { background: var(--navy2); color: #fff; box-shadow: inset 3px 0 0 var(--gold); font-weight: 600; }
  .side .sp { flex: 1; }
  .main { margin-left: 220px; padding: 24px 28px 40px; max-width: none; }
  .topbar { position: fixed; left: 0; right: 0; }
  body { padding-top: 56px; }
  .topbar .who { max-width: 300px; }
}

/* Bileşenler */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.grid { display: grid; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 6px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(5, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: block; color: var(--text); }
.stat b { display: block; font-size: 28px; line-height: 1.1; color: var(--navy); }
.stat span { font-size: 13px; color: var(--mute); }
.stat.hot b { color: var(--bad); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.sb { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.mute { color: var(--mute); }
.small { font-size: 13px; }
.empty { text-align: center; color: var(--mute); padding: 26px 10px; border: 1px dashed var(--line); border-radius: var(--r); background: #fff; }

.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--navy); font: inherit; font-weight: 600;
  min-height: 44px; padding: 8px 16px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.gold { background: var(--gold); color: #1c1500; border-color: var(--gold); }
.btn.danger { color: var(--bad); border-color: #e5b9b3; }
.btn.sm { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--mute); margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid #c4cde0; border-radius: 10px;
  padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold-d); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.two.w { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.err { color: var(--bad); font-size: 14px; margin-top: 10px; min-height: 20px; }

.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: #e8edf6; color: var(--navy); }
.b-bekliyor { background: #fdecc8; color: #8a5a00; }
.b-planlandi { background: #dce8fa; color: #1b4a8c; }
.b-yolda { background: #e4dcf7; color: #5232a0; }
.b-devam { background: #d3f0e0; color: #146c3a; }
.b-tamamlandi { background: #e3e7ee; color: #4a566d; }
.b-iptal { background: #f7dcd8; color: #962d20; }
.tag { font-size: 12px; background: #eef1f7; color: var(--mute); padding: 2px 8px; border-radius: 6px; }
.tag.acil { background: #f7dcd8; color: #962d20; font-weight: 700; }
.tag.yuksek { background: #fdecc8; color: #8a5a00; font-weight: 700; }

.job { display: block; color: var(--text); padding: 12px 14px 12px 16px; position: relative; overflow: hidden; }
.job::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: #c4cde0; }
.job.pr-yuksek::before { background: var(--warn); }
.job.pr-acil::before { background: var(--bad); }
.job.st-tamamlandi, .job.st-iptal { opacity: .65; }
.job-top { display: flex; justify-content: space-between; align-items: center; gap: 4px 8px; margin-bottom: 4px; flex-wrap: wrap; }
.job .time { font-weight: 700; color: var(--navy); font-size: 14px; }
.job-title { font-weight: 600; }
.job-meta { font-size: 14px; color: var(--mute); margin-top: 2px; }
.job-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 13px; }
.job-foot .who { margin-left: auto; color: var(--mute); }
.list { display: grid; gap: 10px; }
@media (min-width: 900px) { .list.cols { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 14px; font-size: 14px; font-weight: 600; color: var(--mute); cursor: pointer; font-family: inherit; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.filters { display: grid; gap: 8px; margin-bottom: 12px; }
@media (min-width: 700px) { .filters { grid-template-columns: 2fr 1fr; } }

/* Program (hafta) */
.week { display: grid; gap: 12px; }
@media (min-width: 700px) { .week { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); align-items: start; } }
@media (min-width: 1560px) { .week { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.day { min-width: 0; }
.day-h { font-weight: 700; color: var(--navy); padding: 6px 2px; display: flex; justify-content: space-between; align-items: baseline; }
.day-h small { color: var(--mute); font-weight: 500; }
.day.today .day-h { color: var(--gold-d); }
.day .list { gap: 8px; }
.day .empty { padding: 10px; font-size: 13px; }
.weeknav { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.weeknav .lbl { font-weight: 700; flex: 1; text-align: center; min-width: 160px; }

/* Detay */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 15px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; word-break: break-word; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.actions .btn { flex: 1 1 140px; }
.timeline { display: grid; gap: 10px; }
.ev { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; font-size: 14px; }
.ev.note { border-color: var(--gold); }
.ev small { color: var(--mute); display: block; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; background: #e8edf6; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(8, 18, 36, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 16px; } }
.sheet h3 { margin: 0 0 4px; color: var(--navy); }
.sheet .btns { display: flex; gap: 10px; margin-top: 16px; }
.sheet .btns .btn { flex: 1; }
.lightbox { align-items: center; background: rgba(0,0,0,.88); flex-direction: column; gap: 12px; padding: 12px; }
.lightbox img { max-width: 100%; max-height: 80vh; border-radius: 8px; }

/* Giriş */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, var(--navy), var(--navy2)); }
.login .box { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 26px 22px; }
.login img { width: 64px; height: 64px; border-radius: 16px; display: block; margin: 0 auto 10px; }
.login h1 { text-align: center; margin-bottom: 2px; color: var(--navy); }
.login p { text-align: center; margin: 0 0 8px; color: var(--mute); font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: .25s; z-index: 80; max-width: 90vw; text-align: center; font-size: 15px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }
@media (min-width: 900px) { .toast { bottom: 24px; } }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
