/* Saha Takip — sade, mobil öncelikli arayüz */
:root {
    --bg: #f5f5f2;
    --card: #ffffff;
    --text: #1c1d1f;
    --muted: #6b6f76;
    --line: #e3e3de;
    --primary: #23479a;
    --primary-soft: #eef1f8;
    --green: #15803d;
    --green-soft: #ecfdf3;
    --orange: #c2410c;
    --orange-soft: #fff4ed;
    --red: #b91c1c;
    --red-soft: #fef2f2;
    --teal: #0f766e;
    --teal-soft: #ecfdfa;
    --gray-soft: #f1f1ed;
    --radius: 8px;
    --shadow: 0 0 0 1px var(--line);
    --nav-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--text);
    background: var(--bg);
    -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
svg.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- Yerleşim ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    height: 56px; padding: 0 16px;
    background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 16px; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 4px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 14px; }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: 14px; color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--gray-soft); color: var(--text); }

.shell { display: flex; }
.sidebar { display: none; }
.main { flex: 1; min-width: 0; padding: 16px 16px calc(var(--nav-h) + 24px); max-width: 1100px; margin: 0 auto; width: 100%; }
.main.narrow { max-width: 640px; }
.main.no-nav { padding-bottom: 32px; }

.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    display: flex; height: var(--nav-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--card); border-top: 1px solid var(--line);
}
.bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 11px; font-weight: 600; color: var(--muted);
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a.fab svg.icon { width: 26px; height: 26px; background: var(--primary); color: #fff; border-radius: 6px; padding: 4px; }

@media (min-width: 900px) {
    .sidebar {
        display: flex; flex-direction: column; gap: 4px;
        position: sticky; top: 56px; height: calc(100vh - 56px);
        width: 230px; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--card);
    }
    .sidebar a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: #374151; font-weight: 550; font-size: 15px; }
    .sidebar a:hover { background: var(--gray-soft); }
    .sidebar a.active { background: var(--primary-soft); color: var(--primary); }
    .sidebar a.btn { margin-top: 8px; color: #fff; justify-content: center; }
    .sidebar a.btn:hover { background: var(--primary); }
    .bottom-nav.admin { display: none; }
    .main { padding: 24px 28px 40px; }
}

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; margin-bottom: 8px; }

/* ---------- Kartlar ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card, .stack > * + * { margin-top: 12px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 20px 4px 8px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 900px) {
    .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .cols-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .cols-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 899px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: block; color: inherit; }
.stat .num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat.red .num { color: var(--red); }
.stat.orange .num { color: var(--orange); }
.stat.green .num { color: var(--green); }

/* ---------- Durum etiketleri ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-gray { background: var(--gray-soft); color: #374151; }
.chip-blue { background: var(--primary-soft); color: var(--primary); }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-orange { background: var(--orange-soft); color: var(--orange); }
.chip-teal { background: var(--teal-soft); color: var(--teal); }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-urgent { background: #f5c518; color: #1c1d1f; }

/* ---------- İş listesi ---------- */
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 14px 16px; color: inherit; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item:hover { background: #fafbfc; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); margin-top: 4px; }
.list-item .meta span { display: inline-flex; align-items: center; gap: 4px; }
.list-item .meta svg.icon { width: 14px; height: 14px; }
.list-item .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.late { color: var(--red) !important; font-weight: 650; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg.icon { width: 40px; height: 40px; stroke-width: 1.5; margin-bottom: 8px; }

/* Usta iş kartları (büyük) */
.job-card { display: block; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; color: inherit; border-left: 4px solid var(--line); }
.job-card + .job-card { margin-top: 12px; }
.job-card.s-pending { border-left-color: #9ca3af; }
.job-card.s-in_progress { border-left-color: var(--primary); }
.job-card.s-done { border-left-color: var(--green); }
.job-card.s-incomplete { border-left-color: var(--orange); }
.job-card.s-approved { border-left-color: var(--teal); }
.job-card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.job-card .title { font-size: 18px; font-weight: 700; margin: 8px 0 4px; }
.job-card .loc { font-size: 15px; color: #374151; }
.job-card .due { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; color: var(--muted); }

/* Konum kutucukları */
.loc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.loc-tile { background: var(--gray-soft); border-radius: 6px; padding: 10px 8px; text-align: center; }
.loc-tile .k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.loc-tile .v { font-size: 20px; font-weight: 700; }

.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { flex: 1; text-align: center; padding: 11px 8px; font-weight: 600; font-size: 15px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--text); }

/* ---------- Butonlar ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 16px; border-radius: 6px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
    background: var(--primary); color: #fff;
}
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-light { background: var(--card); color: var(--text); border-color: var(--line); }
.btn-light:hover { background: var(--gray-soft); filter: none; }
.btn-green { background: var(--green); }
.btn-orange { background: var(--orange); }
.btn-red { background: var(--red); }
.btn-ghost-red { background: transparent; color: var(--red); border-color: #fecaca; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-xl { min-height: 58px; font-size: 18px; border-radius: 8px; }

/* Usta: büyük çekim butonları */
.capture-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.capture-btn {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 92px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); color: var(--text);
    font-weight: 700; font-size: 16px; cursor: pointer; text-align: center;
}
.capture-btn svg.icon { width: 28px; height: 28px; color: var(--primary); }
.capture-btn:active { background: var(--gray-soft); }
.capture-btn.wide { grid-column: span 2; min-height: 54px; flex-direction: row; font-size: 15px; background: var(--card); border-color: var(--line); color: #374151; }
.capture-btn.wide svg.icon { width: 22px; height: 22px; }
.capture-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* ---------- Formlar ---------- */
.field { display: block; }
.field + .field { margin-top: 14px; }
.field label, .label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: #374151; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.input, select.input, textarea.input {
    width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #d4d4ce; border-radius: 6px;
    font: inherit; font-size: 16px; color: var(--text); background: #fff; outline: none; appearance: none;
}
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 36px; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .15); }
.input.is-invalid { border-color: var(--red); }
.error { color: var(--red); font-size: 13.5px; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .field + .field { margin-top: 0; }
.form-grid .full { grid-column: 1 / -1; }
@media (min-width: 600px) { .form-grid.five { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.chips-select { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chips-select button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 7px 14px; font: inherit; font-size: 14px; font-weight: 600; color: #374151; cursor: pointer; }
.chips-select button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.filters { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.filters .search { grid-column: 1 / -1; }
@media (min-width: 900px) { .filters { grid-template-columns: 2fr repeat(4, 1fr) auto; } .filters .search { grid-column: auto; } }

/* ---------- Bildirimler ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 6px; margin-bottom: 14px; font-weight: 550; }
.alert-ok { background: var(--green-soft); color: var(--green); }
.alert-err { background: var(--red-soft); color: var(--red); }
.alert-info { background: var(--primary-soft); color: var(--primary); }
.alert-warn { background: var(--orange-soft); color: var(--orange); }

/* ---------- Medya ---------- */
.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.media-item { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #e5e7eb; cursor: zoom-in; }
.media-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item .badge { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 3px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; }
.media-item .badge svg.icon { width: 12px; height: 12px; }
.media-item .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.media-item .play svg.icon { width: 36px; height: 36px; fill: rgba(0,0,0,.45); }
.media-item .del { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; cursor: pointer; }
.media-item .del svg.icon { width: 16px; height: 16px; }
.media-item.processing { display: grid; place-items: center; text-align: center; font-size: 12px; color: var(--muted); cursor: default; }

.uploads { margin-top: 10px; }
.upload-row { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 8px 0; }
.upload-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { flex: 1.2; height: 8px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.upload-row.ok .progress > i { background: var(--green); }
.upload-row.err { color: var(--red); }

dialog.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
dialog.lightbox::backdrop { background: rgba(0, 0, 0, .88); }
dialog.lightbox img, dialog.lightbox video { max-width: 96vw; max-height: 86vh; display: block; border-radius: 8px; }
dialog.lightbox .close { position: fixed; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; display: grid; place-items: center; cursor: pointer; }

/* ---------- Detay ---------- */
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; }
.note-box { background: var(--gray-soft); border-radius: 6px; padding: 10px 12px; white-space: pre-line; font-size: 15px; }
.note-box.orange { background: var(--orange-soft); }

.share-box { display: flex; gap: 8px; align-items: center; background: var(--gray-soft); border-radius: 6px; padding: 6px 6px 6px 12px; }
.share-box input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 14px; color: #374151; outline: none; }
.share-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.btn-wa { background: #16a34a; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { color: var(--muted); font-size: 12.5px; }

/* ---------- Tablo ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; font-weight: 700; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
/* Telefonda tablolar kart olur: her satır bir kart, hücreler küçük kutucuklar */
@media (max-width: 699px) {
    .table-wrap.table-cards { background: transparent; box-shadow: none; overflow: visible; border-radius: 0; }
    .table-cards table, .table-cards tbody { display: block; }
    .table-cards thead { display: none; }
    .table-cards tr {
        display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
        background: var(--card); box-shadow: var(--shadow); border-radius: var(--radius);
        padding: 14px; margin-bottom: 10px;
    }
    .table-cards td { display: block; padding: 7px 8px; border: 0; background: var(--gray-soft); border-radius: 6px; white-space: normal; }
    .table-cards td.num { text-align: left; font-size: 17px; font-weight: 700; }
    .table-cards td::before { content: attr(data-label); display: block; font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; line-height: 1.2; margin-bottom: 3px; overflow-wrap: anywhere; }
    .table-cards td.card-head { grid-column: 1 / -1; background: none; padding: 0 0 4px; font-size: 16px; font-weight: 650; }
    .table-cards td.card-head::before, .table-cards td.card-empty::before { display: none; }
    .table-cards td.card-full { grid-column: 1 / -1; }
    .table-cards td.card-empty { grid-column: 1 / -1; background: none; text-align: center; }
}
.bar { height: 6px; background: #e5e7eb; border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--green); }

/* ---------- Giriş ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px 16px; max-width: 420px; margin: 0 auto; }
.auth .brand { justify-content: center; margin-bottom: 20px; font-size: 20px; }
.auth .brand-mark { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }
.auth .switch { text-align: center; margin-top: 16px; font-size: 15px; }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }

details.collapse > summary { list-style: none; cursor: pointer; }
details.collapse > summary::-webkit-details-marker { display: none; }

@media print {
    .topbar, .sidebar, .bottom-nav, .no-print, .page-head .actions { display: none !important; }
    body { background: #fff; }
    .main { padding: 0; max-width: none; }
    .card, .table-wrap, .stat, .list { box-shadow: none; border: 1px solid var(--line); }
}
