/* ===========================================================
   ERMAKS ERP — temiz, açık, kurumsal arayüz
   Renk: beyaz yüzeyler, serin gri zemin, ölçülü turuncu vurgu
   Tip:  Inter (gövde), Space Grotesk (başlık/metrik), JetBrains Mono (seri no)
   =========================================================== */
:root {
    --brand: #d2a04b;        /* logodaki gold */
    --brand-dark: #b5893a;   /* koyu gold (hover) */
    --brand-tint: #f9f2e3;   /* açık gold zemin */
    --brand-tint-2: #f1e4c7;

    --bg: #eef1f6;            /* sayfa zemini (hafif serin gri) */
    --surface: #ffffff;      /* kart/panel */
    --sidebar: #ffffff;
    --rail: #edeff3;         /* ince cetvel çizgisi */
    --rail-strong: #e0e4ea;

    --ink: #101828;          /* birincil metin */
    --ink-2: #475467;        /* ikincil */
    --muted: #8a93a4;        /* soluk */

    --ok: #067647;  --ok-bg: #ecfdf3;
    --warn: #b54708; --warn-bg: #fffaeb;
    --err: #b42318; --err-bg: #fef3f2;
    --info: #175cd3; --info-bg: #eff8ff;

    --r-sm: 8px; --r: 11px; --r-lg: 16px;
    --sh-1: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
    --sh-2: 0 2px 6px rgba(16,24,40,.06), 0 6px 16px -6px rgba(16,24,40,.10);
    --sh-3: 0 12px 32px -8px rgba(16,24,40,.18);

    --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
    background: var(--bg); color: var(--ink);
    font-family: var(--sans); font-size: 14px; line-height: 1.5;
    font-feature-settings: "cv05" 1, "ss01" 1;
    letter-spacing: -0.006em;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
.mono { font-family: var(--mono); font-feature-settings: normal; letter-spacing: -0.02em; }
.display { font-family: var(--display); }

/* ---------- Yerleşim ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 244px; background: var(--sidebar); color: var(--ink-2);
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 1030;
    border-right: 1px solid var(--rail);
    box-shadow: 1px 0 3px rgba(16,24,40,.03);
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #e3e6ea; border-radius: 3px; }

.sidebar-brand {
    display: flex; align-items: center; gap: .55rem;
    padding: 1.35rem 1.25rem; margin-bottom: .25rem;
    border-bottom: 1px solid var(--rail);
}
.sidebar-brand .brand-logo { height: 38px; width: auto; display: block; }
.sidebar-brand .brand-erp {
    font-family: var(--display); font-weight: 700; font-size: .72rem;
    color: var(--brand); letter-spacing: .04em;
    background: var(--brand-tint); padding: .1rem .4rem; border-radius: 6px;
    align-self: flex-start; margin-top: .1rem;
}

.sidebar-nav { padding: .65rem .7rem 1.5rem; flex: 1; }
.sidebar-footer { padding: .7rem 1.25rem; border-top: 1px solid var(--rail); font-size: .7rem; font-weight: 600; color: var(--ink-2); }
.sidebar-footer span { color: var(--muted); font-weight: 500; }
.sidebar-heading {
    padding: 1rem .55rem .35rem; font-size: .66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
}
.sidebar .nav-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .53rem .7rem; margin: 1px 0;
    color: var(--ink-2); font-size: .875rem; font-weight: 500;
    border-radius: var(--r-sm); transition: background .13s, color .13s;
    position: relative;
}
.sidebar .nav-link i { font-size: 1.02rem; width: 1.25rem; text-align: center; color: var(--muted); transition: color .13s; }
.sidebar .nav-link:hover { background: #f5f6f8; color: var(--ink); }
.sidebar .nav-link:hover i { color: var(--ink-2); }
.sidebar .nav-link.active { background: var(--brand-tint); color: var(--brand-dark); font-weight: 600; }
.sidebar .nav-link.active i { color: var(--brand); }
.sidebar .nav-link.active::before {
    content: ""; position: absolute; left: -.7rem; top: 20%; bottom: 20%;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--brand);
}
.sidebar .nav-link.disabled { color: #b3bac6; cursor: default; }
.sidebar .nav-link.disabled:hover { background: transparent; }
.sidebar .nav-link.disabled i { color: #cbd1da; }
.sidebar .nav-link .badge {
    margin-left: auto; font-size: .58rem; font-weight: 600; padding: .18em .5em;
    background: #f0f1f4 !important; color: #98a2b3 !important; border-radius: 5px;
}

.main { flex: 1; margin-left: 244px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 60px; background: rgba(255,255,255,.8); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--rail);
    display: flex; align-items: center; gap: 1rem; padding: 0 1.6rem;
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-family: var(--display); font-weight: 600; font-size: 1rem; color: var(--ink); }
.topbar-right { margin-left: auto; }
.user-chip {
    display: flex; align-items: center; gap: .5rem; color: var(--ink);
    font-weight: 600; font-size: .86rem; padding: .35rem .6rem; border-radius: var(--r-sm);
    transition: background .13s;
}
.user-chip:hover { background: #f2f3f6; color: var(--ink); }
.user-chip > i { font-size: 1.4rem; color: var(--brand); }
.content { padding: 1.75rem 1.6rem; flex: 1; max-width: 1400px; width: 100%; }

.dropdown-menu {
    border: 1px solid var(--rail); box-shadow: var(--sh-3);
    border-radius: var(--r); padding: .35rem; font-size: .875rem;
}
.dropdown-item { border-radius: 6px; padding: .48rem .65rem; }
.dropdown-item:active { background: var(--brand); }

/* ---------- Sayfa başlığı ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; flex-wrap: wrap; gap: .8rem; }
.page-head h1 { font-family: var(--display); font-size: 1.45rem; font-weight: 600; margin: 0; color: var(--ink); letter-spacing: -0.02em; }

/* ---------- Kartlar ---------- */
.card { border: 1px solid rgba(16,24,40,.04); box-shadow: var(--sh-1); border-radius: var(--r-lg); background: var(--surface); }
.card-header { background: var(--surface) !important; border-bottom: 1px solid var(--rail); font-weight: 600; font-size: .92rem; padding: 1rem 1.2rem; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card-header strong { font-weight: 600; letter-spacing: -0.01em; }
.card-body { padding: 1.2rem; }
.card-footer { background: var(--surface); border-top: 1px solid var(--rail); }

/* ---------- KPI ---------- */
.kpi-card { border-radius: var(--r-lg); transition: box-shadow .18s ease, transform .18s ease; position: relative; overflow: hidden; }
a:hover > .kpi-card, .kpi-card:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.kpi-card .card-body { display: flex; flex-direction: column; padding: 1.25rem 1.3rem; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; }
.kpi-tag { font-size: .71rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi-dot { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; }
.kpi-value { font-family: var(--display); font-size: 2.2rem; font-weight: 600; line-height: 1; color: var(--ink); letter-spacing: -0.03em; }
.kpi-sub { font-size: .79rem; color: var(--muted); margin-top: .4rem; }
.kpi-card.is-accent { box-shadow: 0 0 0 1px var(--brand) inset, var(--sh-1); }
.kpi-card.is-accent .kpi-value { color: var(--brand); }

/* ---------- Tablolar ---------- */
.table { --bs-table-hover-bg: #f8f9fb; margin: 0; color: var(--ink); }
.table thead th {
    font-size: .69rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 600; border: none;
    padding: .7rem 1.15rem; background: #fcfcfd;
}
.table tbody td { padding: .82rem 1.15rem; vertical-align: middle; border-bottom: 1px solid #f0f2f5; }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr { transition: background .1s; }
.card > .table-responsive:first-child .table thead th:first-child,
.card > .table-responsive > .table thead th:first-child { border-top-left-radius: 0; }
td .sub, .cell-sub { color: var(--muted); font-size: .78rem; }
.table .num, td.num, th.num { font-family: var(--mono); font-size: .82rem; }

/* ---------- Filtre çubuğu ---------- */
.filter-bar { background: var(--surface); border: 1px solid var(--rail); border-radius: var(--r-lg); padding: .95rem 1.1rem; margin-bottom: 1.4rem; box-shadow: var(--sh-1); }
.filter-bar .form-label { font-size: .72rem; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .3rem; }

/* ---------- Formlar ---------- */
.form-control, .form-select {
    border-radius: var(--r-sm); border: 1px solid var(--rail-strong);
    padding: .5rem .7rem; font-size: .875rem; color: var(--ink); background-color: #fff;
}
/* select açılır-ok göstergesi (Bootstrap chevron) korunsun + yer açılsın */
.form-select { padding-right: 2rem; background-position: right .6rem center; }
.form-control::placeholder { color: #b0b7c3; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(210,160,75,.22); }
.form-control-lg { padding: .65rem .85rem; font-size: .95rem; }
.form-label { font-weight: 500; font-size: .85rem; color: var(--ink-2); margin-bottom: .35rem; }
.form-text { font-size: .78rem; color: var(--muted); }
.input-group > :not(:first-child) { margin-left: -1px; }

/* ---------- Butonlar ---------- */
.btn { border-radius: var(--r-sm); font-weight: 600; font-size: .86rem; padding: .5rem .95rem; transition: all .13s; }
.btn-ermaks { background: var(--brand); border: 1px solid var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(210,160,75,.30); }
.btn-ermaks:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-secondary { background: #fff; border: 1px solid var(--rail-strong); color: var(--ink-2); }
.btn-secondary:hover { background: #f6f7f9; border-color: var(--rail-strong); color: var(--ink); }
.btn-light { background: #f4f5f7; border: 1px solid transparent; color: var(--ink-2); }
.btn-light:hover { background: #e9ebef; color: var(--ink); }
.btn-outline-secondary { border-color: var(--rail-strong); color: var(--ink-2); }
.btn-outline-secondary:hover { background: #f6f7f9; border-color: var(--rail-strong); color: var(--ink); }
.btn-link { color: var(--ink-2); font-weight: 500; text-decoration: none; }
.btn-link:hover { color: var(--brand); }
.btn-sm { padding: .32rem .6rem; font-size: .8rem; }

/* Ana sayfa hızlı işlem butonları (stok) — düz, sakin */
.action-btn { display:flex; flex-direction:column; align-items:center; gap:.35rem; padding:1.05rem .5rem; border-radius: var(--r); border:1px solid var(--rail); background:#fff; color:var(--ink); font-weight:600; font-size:.85rem; transition:all .14s; }
.action-btn i { font-size:1.3rem; }
.action-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); transform: translateY(-1px); }

/* ---------- Ürün arama (teklif satırları) ---------- */
.prod-search { position: relative; }
.prod-search-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
    background: #fff; border: 1px solid var(--rail-strong); border-radius: var(--r);
    box-shadow: var(--sh-3); max-height: 280px; overflow-y: auto; display: none;
}
.prod-search-results.show { display: block; }
.prod-search-item {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .55rem .8rem; cursor: pointer; border-bottom: 1px solid var(--rail); font-size: .88rem;
}
.prod-search-item:last-child { border-bottom: none; }
.prod-search-item:hover, .prod-search-item.active { background: var(--brand-tint); }
.prod-search-item .code { color: var(--muted); font-family: var(--mono); font-size: .76rem; white-space: nowrap; }

/* ---------- Durum etiketleri ---------- */
.status-badge { font-size: .72rem; font-weight: 600; padding: .28em .65em; border-radius: 6px; display: inline-flex; align-items:center; gap:.3em; letter-spacing: 0; }
.status-badge::before { content:""; width:6px; height:6px; border-radius:50%; background: currentColor; opacity:.9; }
.status-green { background: var(--ok-bg); color: var(--ok); }
.status-yellow { background: var(--warn-bg); color: var(--warn); }
.status-blue { background: var(--info-bg); color: var(--info); }
.status-red { background: var(--err-bg); color: var(--err); }
.status-gray { background: #f2f4f7; color: #667085; }
.badge.bg-light { background: #f2f4f7 !important; color: var(--ink-2) !important; font-weight: 500; border: none !important; }
.badge.bg-primary-subtle { background: var(--brand-tint) !important; color: var(--brand-dark) !important; }

/* ---------- İlerleme ---------- */
.progress { border-radius: 20px; background: #eef0f4; height: 8px; }
.progress-bar { border-radius: 20px; background: var(--brand); font-size: 0; }
.progress.tall { height: 20px; }
.progress.tall .progress-bar { font-size: .7rem; font-weight: 600; }

/* ---------- Uyarılar ---------- */
.alert { border-radius: var(--r); border: 1px solid transparent; font-weight: 500; font-size: .875rem; padding: .8rem 1rem; }
.alert-success { background: var(--ok-bg); color: var(--ok); border-color: #a6f0c6; }
.alert-danger { background: var(--err-bg); color: var(--err); border-color: #fecdc9; }
.alert-warning { background: var(--warn-bg); color: var(--warn); border-color: #fde08a; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: #b2ddff; }

.list-group-item { border-color: #f0f2f5; padding: .8rem 1.15rem; }
hr { color: var(--rail); opacity: 1; }

/* ---------- Giriş ekranı ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(900px 500px at 85% -10%, var(--brand-tint) 0%, transparent 60%),
        radial-gradient(700px 500px at 0% 110%, #eef1f6 0%, transparent 55%),
        var(--bg);
    padding: 1.25rem;
}
.login-card { background: #fff; border-radius: 18px; box-shadow: var(--sh-3); border: 1px solid var(--rail); width: 100%; max-width: 400px; padding: 2.4rem 2.2rem; }
.login-logo { text-align: center; margin-bottom: 1.9rem; }
.login-logo .login-brand-logo { width: 200px; max-width: 80%; height: auto; }
.login-logo .sub { color: var(--muted); font-size: .85rem; margin-top: .7rem; }

/* ---------- Topbar: bildirim zili + tema düğmesi ---------- */
.topbar-notif { margin-left: auto; }
.topbar-right { margin-left: 0; }
.theme-toggle {
    background: transparent; border: 1px solid var(--rail-strong);
    color: var(--ink-2); width: 36px; height: 36px; border-radius: var(--r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.05rem; cursor: pointer; transition: all .13s;
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand); }
.topbar-bell {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--r-sm); color: var(--ink-2);
    font-size: 1.1rem; transition: all .13s;
}
.topbar-bell:hover { color: var(--brand); background: var(--brand-tint); }
.bell-badge {
    position: absolute; top: -1px; right: -1px; min-width: 17px; height: 17px;
    padding: 0 4px; background: var(--err); color: #fff; font-size: .64rem; font-weight: 700;
    border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--surface);
}
.notif-menu { min-width: 300px; padding: .4rem; }
.notif-head { padding: .5rem .6rem .4rem; font-weight: 700; font-size: .8rem; color: var(--ink); }
.notif-item { display: flex; align-items: center; gap: .65rem; padding: .55rem .6rem; }
.notif-ico { width: 30px; height: 30px; flex: none; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; }
.notif-ico.err { background: var(--err-bg); color: var(--err); }
.notif-ico.warn { background: var(--warn-bg); color: var(--warn); }
.notif-ico.info { background: var(--info-bg); color: var(--info); }
.notif-text { flex: 1; font-size: .85rem; color: var(--ink); }
.notif-count { font-weight: 700; font-size: .85rem; color: var(--ink-2); font-family: var(--mono); }
.notif-empty { padding: 1rem .6rem; text-align: center; color: var(--muted); font-size: .85rem; }

/* ========================================================
   KOYU MOD  (data-theme="dark")
   ======================================================== */
:root[data-theme="dark"] {
    --brand: #e0ad57; --brand-dark: #cf9c46;
    --brand-tint: #2c2417; --brand-tint-2: #35291a;
    --bg: #0f1319; --surface: #191f29; --sidebar: #151a22;
    --rail: #273040; --rail-strong: #3a4457;
    --ink: #e7eaf0; --ink-2: #aab3c2; --muted: #7c8698;
    --ok: #4ade80; --ok-bg: #12291d;
    --warn: #fbbf24; --warn-bg: #2c2410;
    --err: #f87171; --err-bg: #2c1717;
    --info: #60a5fa; --info-bg: #13233d;
    --sh-1: 0 1px 2px rgba(0,0,0,.35);
    --sh-2: 0 2px 8px rgba(0,0,0,.45);
    --sh-3: 0 12px 32px -8px rgba(0,0,0,.6);
}
[data-theme="dark"] body { background: var(--bg); }
[data-theme="dark"] .topbar { background: rgba(21,26,34,.85); }
[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb { background: #2a3342; }
[data-theme="dark"] .sidebar .nav-link:hover { background: #212836; }
[data-theme="dark"] .sidebar .nav-link:hover i { color: var(--ink); }
[data-theme="dark"] .sidebar .nav-link.disabled { color: #5a6472; }
[data-theme="dark"] .sidebar .nav-link.disabled i { color: #47515f; }
[data-theme="dark"] .sidebar .nav-link .badge { background: #2a3342 !important; color: #8a94a6 !important; }
[data-theme="dark"] .user-chip:hover { background: #212836; }
[data-theme="dark"] .card { border-color: var(--rail); }
[data-theme="dark"] .table { --bs-table-hover-bg: #202836; color: var(--ink); }
[data-theme="dark"] .table thead th { background: #141a23; }
[data-theme="dark"] .table tbody td { border-bottom-color: var(--rail); }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select { background-color: var(--surface); color: var(--ink); }
[data-theme="dark"] .form-select { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23aab3c2' stroke-width='2'%3e%3cpath d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); }
[data-theme="dark"] .form-control::placeholder { color: #5c6675; }
[data-theme="dark"] .btn-secondary { background: var(--surface); color: var(--ink-2); }
[data-theme="dark"] .btn-secondary:hover { background: #212836; color: var(--ink); }
[data-theme="dark"] .btn-light { background: #212836; color: var(--ink-2); }
[data-theme="dark"] .btn-light:hover { background: #2a3342; color: var(--ink); }
[data-theme="dark"] .btn-outline-secondary { color: var(--ink-2); }
[data-theme="dark"] .btn-outline-secondary:hover { background: #212836; color: var(--ink); }
[data-theme="dark"] .action-btn { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .prod-search-results { background: var(--surface); }
[data-theme="dark"] .dropdown-menu { --bs-dropdown-bg: var(--surface); --bs-dropdown-link-color: var(--ink); --bs-dropdown-link-hover-bg: #212836; --bs-dropdown-link-hover-color: var(--ink); background: var(--surface); }
[data-theme="dark"] .status-gray { background: #29313e; color: #9aa4b4; }
[data-theme="dark"] .badge.bg-light { background: #29313e !important; color: var(--ink-2) !important; }
[data-theme="dark"] .progress { background: #29313e; }
[data-theme="dark"] .list-group-item { border-color: var(--rail); background: var(--surface); color: var(--ink); }
[data-theme="dark"] .alert-success { border-color: #1c4a33; }
[data-theme="dark"] .alert-danger { border-color: #4a1f1c; }
[data-theme="dark"] .alert-warning { border-color: #4a3a12; }
[data-theme="dark"] .alert-info { border-color: #1c3a5e; }
[data-theme="dark"] .alert-light { background: var(--surface); border-color: var(--rail); color: var(--ink-2); }
[data-theme="dark"] .bg-white { background: var(--surface) !important; }
[data-theme="dark"] .text-dark { color: var(--ink) !important; }
[data-theme="dark"] .login-card { background: var(--surface); }
[data-theme="dark"] .doc-sheet, [data-theme="dark"] .doc-table thead th { background: var(--surface); }
[data-theme="dark"] .doc-table thead th { background: var(--brand-tint); }
[data-theme="dark"] .doc-table tbody tr:nth-child(even) td { background: #1e2530; }
.login-logo .sub span { color: var(--brand); font-weight: 600; }

/* ---------- Duyarlı ---------- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--sh-3); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .content { padding: 1.1rem; }
    .topbar { padding: 0 1.1rem; }
    .page-head h1 { font-size: 1.25rem; }
}
