/* ============ Çiftliğim — Tema ============ */
:root {
    --brand: #16A34A;
    --brand-600: #0f8a3e;
    --brand-700: #0B6B3A;
    --brand-050: #e9f8ef;
    --accent: #0ea5e9;
    --accent-700: #0369a1;

    --bg: #eef1f4;
    --surface: #ffffff;
    --surface-2: #f7f9fb;
    --border: #e3e8ee;
    --border-2: #d7dee6;

    --ink: #16202c;
    --ink-2: #3f4c5a;
    --muted: #6b7a8a;
    --muted-2: #93a1b0;

    --good: #16a34a;
    --good-bg: #e7f6ee;
    --warn: #d98a04;
    --warn-bg: #fdf3e0;
    --bad: #dc2626;
    --bad-bg: #fdeaea;
    --info: #0ea5e9;
    --info-bg: #e6f5fd;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(16,32,44,.06), 0 1px 3px rgba(16,32,44,.05);
    --shadow: 0 2px 8px rgba(16,32,44,.07), 0 8px 24px rgba(16,32,44,.06);
    --sidebar-w: 250px;
    --topbar-h: 60px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; color: var(--ink); }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ App shell ============ */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: #0d1b26; color: #cfd8e3;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; z-index: 40;
}
.sidebar-brand { padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 10px 24px; }
.nav-group-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
    color: #6f8296; padding: 14px 12px 6px; font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 9px; color: #c2ccd8;
    font-weight: 500; cursor: pointer; margin-bottom: 2px; transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.active .nav-ic { opacity: 1; }
.nav-ic { width: 20px; text-align: center; font-size: 16px; opacity: .85; }
.nav-badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 7px; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; padding: 0 20px; position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 650; font-size: 15px; }
.topbar-spacer { flex: 1; }
.topbar-chip {
    display: inline-flex; align-items: center; gap: 7px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; color: var(--ink-2);
}
/* Çiftlik seçici (topbar) */
.farm-picker {
    display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px 3px 12px;
}
.farm-picker-ico { font-size: 13px; }
.farm-select {
    border: none; background: transparent; font-size: 13px; font-weight: 600; color: var(--ink);
    cursor: pointer; outline: none; padding: 3px 2px; max-width: 190px;
}

/* Fotoğraf grid (günlük rapor) */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; }
.photo-thumb { position: relative; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.photo-thumb img { width: 100%; height: 110px; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.photo-name { font-size: 10.5px; color: var(--muted); padding: 3px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Puantaj */
.att { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: 5px; font-size: 11px; font-weight: 700; }
.att-Calisti { background: #d9f2e3; color: #0f7a44; }
.att-Izinli { background: #fdeecd; color: #a5730a; }
.att-Raporlu { background: #d9e8fb; color: #1857b8; }
.att-Devamsiz { background: #fadbdb; color: #b3261e; }
.att-HaftaTatili, .att-ResmiTatil { background: var(--surface-2); color: var(--muted); }
.att-Diger { color: var(--muted); }
.att-cell { cursor: pointer; text-align: center; }
.att-cell:hover { background: var(--surface-2); }
.att-tbl th.att-sun { color: var(--bad); }
.att-tbl th, .att-tbl td { padding: 5px 6px; }
.legend { font-size: 11.5px; color: var(--muted); }

.content { padding: 22px 24px 60px; max-width: 1440px; width: 100%; }

.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink); }

/* ============ Brand ============ */
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand-mark { border-radius: 11px; display: block; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 750; font-size: 18px; color: #fff; letter-spacing: -.02em; }
.brand-tag { font-size: 10.5px; color: #7f93a6; letter-spacing: .02em; margin-top: 2px; }

/* ============ Page header ============ */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h1 { font-size: 22px; }
.page-sub { color: var(--muted); margin: 5px 0 0; font-size: 13px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============ Cards ============ */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 15px; }
.card-title-sm { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* ============ KPI cards ============ */
.kpi-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 15px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.kpi-neutral::before { background: var(--muted-2); }
.kpi-good::before { background: var(--good); }
.kpi-warn::before { background: var(--warn); }
.kpi-bad::before { background: var(--bad); }
.kpi-accent::before { background: var(--accent); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kpi-icon { font-size: 18px; }
.kpi-badge { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
.kpi-value { font-size: 26px; font-weight: 720; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.kpi-unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.kpi-title { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; font-weight: 600; }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* ============ Badges ============ */
.badge-pill { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.badge-iyi, .badge-good { background: var(--good-bg); color: var(--good); }
.badge-orta, .badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-kotu, .badge-crit { background: var(--bad-bg); color: var(--bad); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ============ Tables ============ */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--ink-2); }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr.row-clickable { cursor: pointer; }
.t-strong { color: var(--ink); font-weight: 600; }

/* ============ Buttons ============ */
.btn { display: inline-flex; align-items: center; gap: 7px; font-family: inherit; font-size: 13.5px; font-weight: 600; border-radius: var(--radius-sm); padding: 9px 15px; border: 1px solid transparent; cursor: pointer; transition: background .12s, box-shadow .12s, border-color .12s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-700); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============ Forms ============ */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, .select, textarea.input {
    width: 100%; font-family: inherit; font-size: 14px; color: var(--ink);
    background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
    padding: 9px 11px; transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-050); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ============ Charts ============ */
.chart-wrap { width: 100%; }
.chart-legend { display: flex; gap: 18px; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.lg-line { width: 16px; height: 0; border-top-width: 2.5px; border-top-style: solid; display: inline-block; }
.lg-actual { border-top-color: var(--brand); }
.lg-target { border-top-color: var(--muted-2); border-top-style: dashed; }
.svg-chart { width: 100%; height: auto; display: block; }
.svg-chart .grid { stroke: var(--border); stroke-width: 1; }
.svg-chart .axis-lbl { fill: var(--muted); font-size: 10px; }
.svg-chart .line-target { fill: none; stroke: var(--muted-2); stroke-width: 2; stroke-dasharray: 5 4; }
.svg-chart .line-actual { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.svg-chart .dot-actual { fill: var(--brand); }

/* mini bar (kümes karşılaştırma) */
.mini-bar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; min-width: 70px; }
.mini-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }

/* ============ Login ============ */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: linear-gradient(150deg, #0B6B3A, #0d1b26 90%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(22,163,74,.35), transparent 70%); }
.login-hero h2 { color: #fff; font-size: 30px; line-height: 1.2; max-width: 420px; }
.login-hero p { color: #b9c6d3; max-width: 400px; font-size: 15px; }
.hero-points { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.hero-point { display: flex; gap: 11px; align-items: flex-start; color: #dbe4ec; font-size: 14px; }
.hero-point .hp-ic { color: #4ade80; font-weight: 700; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.login-card { width: 100%; max-width: 380px; }
.login-tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px; margin: 22px 0; }
.login-tab { flex: 1; text-align: center; padding: 8px; border-radius: 999px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer; border: none; background: none; }
.login-tab.active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }
.demo-note { background: var(--brand-050); border: 1px solid #cdeeda; color: var(--brand-700); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; margin-bottom: 18px; }
.demo-note b { display: inline-block; }
.login-error { background: var(--bad-bg); color: var(--bad); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }

/* ============ Misc ============ */
.alert-row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 9px; border: 1px solid var(--border); background: var(--surface); }
.alert-row .a-ic { font-size: 17px; line-height: 1.2; }
.alert-crit { border-left: 4px solid var(--bad); }
.alert-warn { border-left: 4px solid var(--warn); }
.alert-normal { border-left: 4px solid var(--info); }
.alert-row .a-title { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.alert-row .a-msg { color: var(--muted); font-size: 12.5px; }

.muted { color: var(--muted); }
.tabular { font-variant-numeric: tabular-nums; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; }
.wrap { flex-wrap: wrap; }
.dev-pos { color: var(--good); font-weight: 600; }
.dev-neg { color: var(--bad); font-weight: 600; }
.chip-toggle { display: inline-flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.chip-toggle button { border: none; background: none; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.chip-toggle button.on { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-sm); }

.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 26px 0 12px; }

.stat-inline { display: flex; gap: 22px; flex-wrap: wrap; }
.stat-inline .si { }
.stat-inline .si .v { font-size: 20px; font-weight: 700; color: var(--ink); }
.stat-inline .si .l { font-size: 12px; color: var(--muted); }

/* ============ Responsive ============ */
@media (max-width: 980px) {
    .login-page { grid-template-columns: 1fr; }
    .login-hero { display: none; }
}
@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: inline-flex; }
    .content { padding: 16px 14px 60px; }
    .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }
    /* Mobil topbar: firma/kullanıcı chip'lerini gizle, başlık kısalsın (yatay taşmayı önle) */
    .topbar { padding: 0 12px; gap: 8px; }
    .topbar-chip { display: none; }
    .topbar-title { display: none; }
    .farm-select { max-width: 120px; font-size: 12px; }
    .farm-picker { padding: 3px 6px 3px 8px; }
    .chip-toggle button { padding: 4px 8px; }
    .page-header h1 { font-size: 19px; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; justify-content: center; }
}
