:root {
    --primary: #2c3e50;
    --secondary: #34495e;
    --accent: #2f80c9;
    --accent-dark: #23679f;
    --success: #27ae60;
    --warning: #e67e22;
    --danger: #c0392b;
    --light: #ecf0f1;
    --muted: #6b7785;
    --border: #d9dee3;
    --bg: #f4f6f8;
    --dark: #212121;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg);
    margin: 0;
    color: var(--dark);
    font-size: 15px;
}

/* ---------- Üst bar ---------- */
.topbar {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 1.1em; color: white; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.topbar .brand img { width: 32px; height: 32px; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.topbar .crumbs { flex: 1; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .crumbs a { color: white; }
.topbar .user { display: flex; gap: 8px; align-items: center; }
.topbar .user a { color: white; text-decoration: none; opacity: .85; }
.topbar .user a:hover { opacity: 1; }
@media (max-width: 560px) { .topbar .crumbs { display: none; } .topbar .user { margin-left: auto; } }

.container { max-width: 960px; margin: 20px auto; padding: 0 16px; }

.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}
.card h3 { margin-top: 0; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85em; }

/* ---------- Form ---------- */
label { display: block; font-weight: 600; margin-top: 12px; font-size: .9em; color: var(--secondary); }
input, textarea, select {
    width: 100%;
    padding: 11px 12px;
    margin: 6px 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    background: white;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1; min-width: 160px; }

/* ---------- Butonlar ---------- */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: var(--accent);
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
button:hover, .btn:hover { background-color: var(--accent-dark); }
button:disabled { opacity: .6; cursor: wait; }
.btn-block { width: 100%; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #1f8f4e; }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #c96b16; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #962d22; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--light); }
.btn-sm { padding: 6px 10px; font-size: .85em; }

.recording { background: #e74c3c !important; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .75; } }

/* ---------- Proje kartları ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.project-card {
    background: white; border-radius: 8px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.08);
    cursor: pointer; border-left: 5px solid var(--accent); transition: transform .1s;
    color: inherit; text-decoration: none; display: block;
}
.project-card:hover { transform: translateY(-2px); }
.project-card.done { border-left-color: var(--muted); opacity: .8; }
.project-card h4 { margin: 0 0 6px; font-size: 1.05em; }
.project-card .meta { font-size: .85em; color: var(--muted); line-height: 1.6; }
.project-card.new { border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center; color: var(--accent); font-weight: 600; min-height: 130px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: .75em; background: var(--light); color: var(--secondary); }

/* ---------- Künye özeti ---------- */
.kunye { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: .95em; }
.kunye dt { color: var(--muted); }
.kunye dd { margin: 0; font-weight: 600; }

/* ---------- Defter sayfaları listesi ---------- */
.log-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid #eee; align-items: flex-start; }
.log-item:last-child { border-bottom: none; }
.log-item input[type=checkbox] { width: 20px; height: 20px; margin-top: 3px; flex-shrink: 0; }
.log-item .body { flex: 1; min-width: 0; }
.log-item .head { font-weight: 600; }
.log-item .preview { color: #555; font-size: .9em; margin: 4px 0; white-space: pre-line; max-height: 4.5em; overflow: hidden; }
.log-item .actions { display: flex; gap: 6px; flex-shrink: 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Defter / rapor etiketleri ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.chip { font-size: .78em; padding: 2px 8px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.chip-defter { background: #e8eef5; color: var(--primary); border: 1px solid #c9d6e3; }
.chip-rapor { background: #fdf0e3; color: #a85a12; border: 1px solid #f3d2ad; }

/* ---------- Kayıt ekranı: ne hazırlansın? ---------- */
.step-title { margin: 22px 0 6px; font-size: 1em; color: var(--secondary); }
.outputs { display: grid; gap: 14px; }
.output { border: 1px solid var(--border); border-radius: 8px; padding: 14px; background: #fbfcfd; }
.output-defter { border-left: 4px solid var(--primary); }
.output-rapor { border-left: 4px solid var(--warning); }
.output-toggle { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-weight: normal; color: var(--dark); cursor: pointer; }
.output-toggle input { width: 20px; height: 20px; margin: 2px 0 0; flex-shrink: 0; }
.output-body { display: grid; gap: 8px; margin-top: 12px; justify-items: start; }
.output-body textarea, .output-body .row { width: 100%; }
.ai-status { color: var(--muted); margin: 0; }
.ai-status:empty { display: none; }
.ai-status.error { color: var(--danger); }

/* ---------- Çalışan kişiler / malzeme tabloları (kayıt ekranı) ---------- */
.tbl-block { margin-top: 12px; display: grid; gap: 6px; justify-items: start; }
.tbl-block .table-wrap { width: 100%; }
.tbl-title { font-weight: 600; color: var(--secondary); }
.edit-table { width: 100%; border-collapse: collapse; min-width: 420px; }
.edit-table th { text-align: left; font-size: .8em; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.edit-table th.num { text-align: right; }
.edit-table td { padding: 3px 4px; }
.edit-table td input { margin: 0; padding: 8px 10px; }
.edit-table td.num { width: 90px; }
.edit-table td.num input { text-align: right; }
.edit-table td.birim { width: 90px; }
.edit-table td:last-child { width: 40px; }
.edit-table tr.empty td { color: var(--muted); font-size: .85em; padding: 8px 6px; }
@media (max-width: 560px) {
    .edit-table { min-width: 0; }
    .edit-table td { padding: 2px; }
    .edit-table td input { padding: 8px 6px; font-size: .95em; }
    .edit-table td.num, .edit-table td.birim { width: 58px; }
    .edit-table td:last-child { width: 30px; }
    .edit-table td:last-child button { padding: 6px 7px; }
}

/* ---------- Proje görseli ---------- */
.cover-field { display: grid; gap: 8px; }
.cover-preview {
    height: 140px; border-radius: 8px; border: 1px solid var(--border);
    background: #eef1f4 center / cover no-repeat;
}
.cover-preview.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .9em; }

.project-card.has-cover {
    background: linear-gradient(rgba(255,255,255,.86), rgba(255,255,255,.94)), var(--cover) center / cover no-repeat;
}

/* ---------- Proje ekranlarında saydam arka plan görseli (belirgin ve hafif bulanık) ---------- */
body.has-backdrop::before {
    content: ""; position: fixed; inset: -12px; z-index: -1; pointer-events: none;
    background: var(--backdrop) center / cover no-repeat;
    opacity: .22;
    filter: blur(3px) grayscale(.25);
}

/* ---------- Fotoğraflar ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.photo { position: relative; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #fafafa; }
.photo img { width: 100%; height: 110px; object-fit: cover; display: block; }
.photo .cap { font-size: .72em; padding: 4px 6px; color: var(--muted); line-height: 1.4; }
.photo .del { position: absolute; top: 4px; right: 4px; padding: 2px 7px; background: rgba(192,57,43,.9); }

.notice { padding: 10px 14px; border-radius: 6px; background: #fff7e6; border: 1px solid #f5d9a8; font-size: .9em; margin: 10px 0; }
.error { color: var(--danger); margin-top: 8px; }

/* ---------- Yönetim ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: white; border-radius: 8px; padding: 14px 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); display: grid; gap: 2px; }
.stat b { font-size: 1.6em; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85em; }
.table-card { padding: 0; overflow: hidden; }
.table-card #adminMsg { padding: 0 16px 14px; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .9em; }
.admin-table th { text-align: left; background: var(--light); color: var(--secondary); padding: 10px 12px; font-size: .85em; white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-top: 1px solid #eee; vertical-align: top; }
.admin-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-table select { width: auto; margin: 0; padding: 6px 8px; }
.temp-pass { font-size: 1.1em; background: #fff7e6; padding: 2px 8px; border-radius: 4px; user-select: all; }

/* ---------- Giriş ---------- */
.login-container { min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 16px; }
.login-box {
    background: white; padding: 36px; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    width: 100%; max-width: 400px; text-align: center;
}
.login-box h1 { margin: 0 0 4px; color: var(--primary); }
.login-logo { width: 96px; height: 96px; margin-bottom: 12px; }
@media (max-width: 480px) { .login-box { padding: 28px 20px; } }

/* ---------- Yasal metin sayfaları ---------- */
.doc { max-width: 760px; margin: 0 auto; padding: 24px 16px 60px; line-height: 1.7; color: #2b3640; }
.doc .back { display: inline-block; margin-bottom: 16px; color: var(--accent); text-decoration: none; font-weight: 600; }
.doc h1 { color: var(--primary); font-size: 1.6em; margin: 0 0 4px; }
.doc .meta { color: var(--muted); font-size: .9em; margin: 0 0 20px; }
.doc h2 { color: var(--primary); font-size: 1.15em; margin: 28px 0 6px; }
.doc table { width: 100%; border-collapse: collapse; font-size: .93em; margin: 8px 0; }
.doc th, .doc td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--light); color: var(--secondary); }
.doc .box { background: white; border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85em; }
.legal-links a { color: inherit; opacity: .8; }
.landing .intro .legal-links { color: #c9d6e3; margin-top: 8px; }
.consent { display: flex; gap: 8px; align-items: flex-start; text-align: left; font-weight: normal; font-size: .85em; color: var(--dark); margin: 10px 0 4px; cursor: pointer; line-height: 1.45; }
.consent input { width: 18px; height: 18px; margin: 1px 0 0; flex-shrink: 0; }
.consent a { color: var(--accent); }

/* ---------- Giriş sayfası: solda tanıtım, sağda giriş ---------- */
.landing { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.landing .intro {
    background: var(--primary); color: white; padding: 56px max(32px, 6vw);
    display: flex; flex-direction: column; justify-content: center; gap: 22px;
}
.landing .intro .brand { display: flex; align-items: center; gap: 14px; }
.landing .intro .brand img { width: 64px; height: 64px; }
.landing .intro h1 { margin: 0; font-size: 2em; }
.landing .intro .lead { margin: 0; font-size: 1.15em; opacity: .9; max-width: 34ch; }
.landing .side { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.landing .login-box h1 { font-size: 1.4em; }
.how { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; text-align: left; }
.how li { display: flex; gap: 12px; align-items: flex-start; }
.how li > div { min-width: 0; }
.how .ic {
    font-size: 1.5em; line-height: 1; width: 44px; height: 44px; flex-shrink: 0;
    display: grid; place-items: center; background: rgba(255,255,255,.1); border-radius: 10px;
}
.how b { display: block; color: white; }
.how li span:not(.ic) { color: #c9d6e3; font-size: .92em; line-height: 1.45; }
.guide-link { color: #f8c471; font-weight: 600; text-decoration: none; }
.guide-link:hover { text-decoration: underline; }
@media (max-width: 860px) {
    .landing { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .landing .intro { padding: 32px 20px; }
    .landing .side { order: -1; padding-top: 28px; }
}
.login-box form { margin-top: 20px; }
.login-box button { width: 100%; margin-top: 10px; }
.login-box .switch { margin-top: 16px; font-size: .9em; }
