/* ===== MEMARLIQ SİSTEMİ v4 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: 13px; color: #0f172a; background: #f1f5f9; }

/* ===== LAYOUT ===== */
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
    width: 220px; min-height: 100vh; background: linear-gradient(180deg, #0f172a 0%, #1e3a8a 100%);
    display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
    transition: transform .25s; box-shadow: 4px 0 20px rgba(0,0,0,.25);
}
.sidebar-logo {
    padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-icon { width: 34px; height: 34px; background: #1d4ed8; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.sidebar-logo-text { font-size: 13px; font-weight: 700; color: #fff; line-height: 1.3; }
.sidebar-logo-sub  { font-size: 10px; color: rgba(255,255,255,.5); }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-section { font-size: 10px; font-weight: 700; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .8px; padding: 10px 8px 4px; }
.nav-item {
    display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 9px;
    color: rgba(255,255,255,.7); cursor: pointer; font-size: 12px; font-weight: 500;
    transition: all .15s; margin-bottom: 2px; text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: #1d4ed8; color: #fff; box-shadow: 0 2px 8px rgba(29,78,216,.4); }
.nav-item .nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: #ef4444; color: #fff; border-radius: 20px; font-size: 10px; font-weight: 700; padding: 1px 6px; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,.1); }
.user-card { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; background: rgba(255,255,255,.07); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.ua-admin { background: #fbbf24; color: #78350f; }
.ua-olcu  { background: #34d399; color: #064e3b; }
.ua-memar { background: #a78bfa; color: #2e1065; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: rgba(255,255,255,.5); }
.btn-logout { padding: 4px 6px; border-radius: 6px; border: none; background: rgba(239,68,68,.2); color: #fca5a5; cursor: pointer; font-size: 11px; transition: all .15s; }
.btn-logout:hover { background: rgba(239,68,68,.35); color: #fff; }

/* MAIN CONTENT */
.main-content { margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.page-header { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.page-title { font-size: 16px; font-weight: 700; color: #0f172a; }
.page-sub   { font-size: 11px; color: #64748b; margin-top: 1px; }
.page-body  { padding: 16px 20px; flex: 1; }

/* MOBILE SIDEBAR */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 90; }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 4px; color: #0f172a; font-size: 20px; }

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; gap: 10px; margin-bottom: 16px; }
.stat-card {
    background: #fff; border-radius: 12px; padding: 14px 16px; cursor: pointer;
    border: 2px solid #e2e8f0; transition: all .2s; position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--sc, #e2e8f0); border-radius: 3px 3px 0 0; }
.stat-card:hover { border-color: #93c5fd; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.stat-card.active { border-color: var(--sc, #1e40af); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.stat-label { font-size: 11px; font-weight: 600; color: #64748b; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-icon { position: absolute; top: 14px; right: 14px; font-size: 22px; opacity: .15; }

/* ===== NOTIFICATIONS ===== */
.notif-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; font-size: 12px; border-left: 4px solid; }
.nb-yellow { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
.nb-purple { background: #f5f3ff; border-color: #7c3aed; color: #4c1d95; }
.nb-red    { background: #fef2f2; border-color: #ef4444; color: #991b1b; }
.nb-green  { background: #f0fdf4; border-color: #22c55e; color: #166534; }

/* ===== TOOLBAR ===== */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; background: #fff; padding: 10px 12px; border-radius: 10px; border: 1px solid #e2e8f0; }
.search-input { padding: 8px 12px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 12px; outline: none; min-width: 220px; flex: 1; max-width: 320px; transition: border .15s; background: #f8fafc; }
.search-input:focus { border-color: #3b82f6; background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.filter-sel { padding: 7px 10px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 12px; background: #f8fafc; outline: none; cursor: pointer; color: #374151; }
.filter-sel:focus { border-color: #3b82f6; background: #fff; }

/* ===== TABLE ===== */
.tbl-wrap { overflow-x: auto; border-radius: 12px; border: 1.5px solid #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,.05); background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
thead th { background: #f8fafc; padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 700; color: #475569; border-bottom: 2px solid #e2e8f0; white-space: nowrap; position: sticky; top: 0; }
tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .1s; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child { border-bottom: none; }
td { padding: 9px 12px; font-size: 12px; vertical-align: middle; }

/* Row states */
.row-tamam  td { background: #f0fdf4; }
.row-tamam:hover td  { background: #dcfce7 !important; }
.row-yeni   td { background: #fffbeb; border-left: 4px solid #f59e0b; }
.row-yeni:hover td   { background: #fef3c7 !important; }
.row-gec    td { background: #fff5f5; }
.row-gec:hover td    { background: #fee2e2 !important; }
.row-duz    td { background: #fff7ed; }
.row-tehvil td { background: #f5f3ff; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.b-yellow { background: #fef3c7; color: #92400e; }
.b-blue   { background: #dbeafe; color: #1e40af; }
.b-red    { background: #fee2e2; color: #991b1b; }
.b-teal   { background: #ccfbf1; color: #0f766e; }
.b-gray   { background: #f1f5f9; color: #475569; }
.b-green  { background: #dcfce7; color: #166534; }
.b-purple { background: #ede9fe; color: #5b21b6; }
.b-orange { background: #fff7ed; color: #9a3412; }
.b-amber  { background: #fef3c7; color: #92400e; }
.b-pink   { background: #fce7f3; color: #9d174d; }

/* ===== BUTTONS ===== */
.btn { padding: 7px 14px; border-radius: 8px; border: 1.5px solid #e2e8f0; background: #fff; color: #374151; cursor: pointer; font-size: 12px; font-weight: 500; transition: all .15s; white-space: nowrap; }
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-primary { background: #1e40af; color: #fff; border-color: #1e3a8a; }
.btn-primary:hover { background: #1e3a8a; }
.btn-success { background: #059669; color: #fff; border-color: #047857; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #dc2626; color: #fff; border-color: #b91c1c; }
.btn-danger:hover { background: #b91c1c; }
.btn-warn { background: #d97706; color: #fff; border-color: #b45309; }
.btn-warn:hover { background: #b45309; }
.btn-sm { padding: 3px 9px; border-radius: 6px; border: 1px solid #e2e8f0; background: #f8fafc; color: #475569; cursor: pointer; font-size: 11px; transition: all .15s; }
.btn-sm:hover { background: #e2e8f0; }
.btn-ghost { padding: 5px 10px; border-radius: 7px; border: 1.5px solid #e2e8f0; background: transparent; color: #64748b; cursor: pointer; font-size: 11px; font-weight: 500; transition: all .15s; }
.btn-ghost:hover { background: #f1f5f9; }

/* Inline action buttons */
.act-ok    { padding: 4px 10px; border-radius: 6px; border: 1.5px solid #86efac; background: #f0fdf4; color: #166534; cursor: pointer; font-size: 11px; font-weight: 700; }
.act-ok:hover { background: #dcfce7; }
.act-warn  { padding: 4px 9px; border-radius: 6px; border: 1.5px solid #fde68a; background: #fffbeb; color: #92400e; cursor: pointer; font-size: 11px; }
.act-send  { padding: 4px 10px; border-radius: 6px; border: 1.5px solid #93c5fd; background: #eff6ff; color: #1e40af; cursor: pointer; font-size: 11px; font-weight: 600; }
.act-send:hover { background: #dbeafe; }
.act-duz   { padding: 4px 9px; border-radius: 6px; border: 1.5px solid #fca5a5; background: #fff5f5; color: #dc2626; cursor: pointer; font-size: 11px; }
.act-duz:hover { background: #fee2e2; }
.act-dwg   { padding: 4px 9px; border-radius: 6px; border: 1.5px solid #c4b5fd; background: #f5f3ff; color: #5b21b6; cursor: pointer; font-size: 11px; font-weight: 500; }
.act-tehvil { padding: 4px 10px; border-radius: 6px; border: 1.5px solid #34d399; background: #f0fdf4; color: #065f46; cursor: pointer; font-size: 11px; font-weight: 700; }

/* Selects */
.sel-memar, .sel-status { padding: 5px 8px; border: 1.5px solid #e2e8f0; border-radius: 7px; font-size: 11px; background: #fff; outline: none; max-width: 150px; cursor: pointer; }
.sel-memar:focus, .sel-status:focus { border-color: #3b82f6; }

/* Links */
.flink { display: inline-block; padding: 3px 9px; border-radius: 6px; background: #eff6ff; color: #1e40af; text-decoration: none; font-size: 11px; font-weight: 600; border: 1px solid #bfdbfe; transition: all .15s; white-space: nowrap; }
.flink:hover { background: #dbeafe; }
.flink-video { background: #f5f3ff; color: #5b21b6; border-color: #c4b5fd; }
.flink-video:hover { background: #ede9fe; }
.flink-none { color: #cbd5e1; font-size: 12px; }

/* Gun cells */
.gun-ok  { color: #059669; font-size: 11px; font-weight: 700; }
.gun-az  { color: #d97706; font-size: 11px; font-weight: 700; }
.gun-gec { color: #dc2626; font-size: 11px; font-weight: 700; }

/* Duzelis cells */
.duz-olcu  { display: inline-block; background: #fee2e2; color: #dc2626; padding: 2px 8px; border-radius: 5px; font-size: 11px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duz-memar { display: inline-block; background: #ede9fe; color: #5b21b6; padding: 2px 8px; border-radius: 5px; font-size: 11px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== LOGIN ===== */
.login-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #1d4ed8 100%); padding: 20px; position: relative; overflow: hidden; }
.login-bg::before { content: ''; position: absolute; width: 600px; height: 600px; border-radius: 50%; background: rgba(59,130,246,.08); top: -200px; right: -200px; }
.login-bg::after  { content: ''; position: absolute; width: 400px; height: 400px; border-radius: 50%; background: rgba(29,78,216,.1); bottom: -100px; left: -100px; }
.login-card { background: #fff; border-radius: 20px; padding: 36px 32px; width: 100%; max-width: 390px; box-shadow: 0 30px 80px rgba(0,0,0,.4); position: relative; z-index: 1; }
.login-logo { width: 50px; height: 50px; background: linear-gradient(135deg,#1e40af,#3b82f6); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 18px; }
.login-title { font-size: 24px; font-weight: 800; color: #0f172a; margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: #64748b; margin-bottom: 24px; }
.form-label  { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 5px; margin-top: 14px; }
.form-input  { width: 100%; padding: 11px 13px; border: 1.5px solid #e2e8f0; border-radius: 9px; font-size: 13px; outline: none; transition: all .15s; color: #0f172a; background: #f8fafc; }
.form-input:focus { border-color: #3b82f6; background: #fff; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.btn-login { width: 100%; margin-top: 20px; padding: 13px; background: linear-gradient(135deg,#1e40af,#2563eb); color: #fff; border: none; border-radius: 10px; font-size: 14px; font-weight: 700; cursor: pointer; transition: all .2s; letter-spacing: .3px; }
.btn-login:hover { background: linear-gradient(135deg,#1e3a8a,#1d4ed8); box-shadow: 0 6px 20px rgba(30,64,175,.4); }
.btn-login:disabled { background: #93c5fd; cursor: not-allowed; box-shadow: none; }
.err-box { background: #fef2f2; color: #dc2626; padding: 10px 13px; border-radius: 8px; font-size: 12px; margin-top: 12px; border: 1px solid #fecaca; font-weight: 500; display: none; }

/* ===== MODAL ===== */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); }
.modal { background: #fff; border-radius: 16px; padding: 26px; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.modal-lg { max-width: 680px; }
.modal h3 { font-size: 17px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.modal-sub { font-size: 12px; color: #64748b; margin-bottom: 16px; line-height: 1.6; }
.modal-label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 5px; margin-top: 14px; }
.modal-input { width: 100%; padding: 9px 12px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 13px; outline: none; transition: all .15s; color: #0f172a; background: #fff; }
.modal-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.12); }
.modal-textarea { width: 100%; padding: 9px 12px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 13px; min-height: 80px; resize: vertical; outline: none; transition: all .15s; font-family: inherit; color: #0f172a; }
.modal-textarea:focus { border-color: #3b82f6; }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.info-box { padding: 10px 13px; border-radius: 8px; font-size: 12px; margin: 8px 0; line-height: 1.6; }
.info-red    { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.info-purple { background: #f5f3ff; color: #5b21b6; border: 1px solid #e9d5ff; }
.info-yellow { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.info-blue   { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.quick-btns  { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.qbtn { padding: 5px 11px; border: 1.5px solid #e2e8f0; border-radius: 7px; background: #f8fafc; font-size: 11px; cursor: pointer; transition: all .15s; color: #374151; }
.qbtn:hover { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }

/* Target select */
.target-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.target-card { border: 2px solid #e2e8f0; border-radius: 12px; padding: 14px; text-align: center; cursor: pointer; transition: all .2s; }
.target-card:hover { border-color: #93c5fd; background: #f0f9ff; }
.target-card.sel-o { border-color: #dc2626; background: #fef2f2; }
.target-card.sel-m { border-color: #5b21b6; background: #f5f3ff; }
.tc-icon { font-size: 26px; margin-bottom: 5px; }
.tc-name { font-size: 13px; font-weight: 700; color: #0f172a; }
.tc-who  { font-size: 11px; color: #64748b; margin-top: 2px; }
.duz-form { display: none; }
.duz-form.show { display: block; }

/* File upload */
.file-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.file-lbl { padding: 6px 12px; border-radius: 7px; background: #eff6ff; color: #1e40af; border: 1.5px solid #bfdbfe; font-size: 11px; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; }
.file-lbl:hover { background: #dbeafe; }
.file-nm { font-size: 11px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.prog-wrap { display: none; margin-top: 10px; }
.prog-bar  { height: 7px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.prog-fill { height: 100%; background: linear-gradient(90deg, #1e40af, #3b82f6); border-radius: 4px; transition: width .3s; width: 0; }
.prog-txt  { font-size: 11px; color: #64748b; margin-top: 5px; text-align: center; }

/* Autocomplete */
.ac-wrap { position: relative; }
.ac-list { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1.5px solid #e2e8f0; border-radius: 9px; box-shadow: 0 10px 30px rgba(0,0,0,.12); z-index: 400; max-height: 200px; overflow-y: auto; margin-top: 2px; display: none; }
.ac-item { padding: 9px 13px; font-size: 12px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.ac-item:last-child { border-bottom: none; }
.ac-item:hover { background: #eff6ff; color: #1e40af; }

/* Users */
.u-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.ua-admin-s { background: #fef3c7; color: #92400e; }
.ua-olcu-s  { background: #d1fae5; color: #065f46; }
.ua-memar-s { background: #ede9fe; color: #5b21b6; }
.pass-row { display: flex; align-items: center; gap: 5px; }

/* Toggle */
.tog-wrap { display: flex; border: 1.5px solid #e2e8f0; border-radius: 9px; overflow: hidden; }
.tog { padding: 6px 14px; border: none; background: #fff; color: #64748b; cursor: pointer; font-size: 12px; font-weight: 500; transition: all .15s; }
.tog.active { background: #1e40af; color: #fff; }

/* Stat matrix */
table.mx thead th { font-size: 10px; padding: 7px 9px; }
table.mx td { font-size: 11px; padding: 6px 9px; }
.fix { position: sticky; left: 0; background: inherit; z-index: 2; font-weight: 700; min-width: 110px; }
.sc2 { text-align: center; font-size: 12px; font-weight: 700; min-width: 50px; }
.mx-cell { display: flex; gap: 3px; justify-content: center; align-items: center; flex-wrap: wrap; }
.mc-a { background: #dbeafe; color: #1e40af; padding: 1px 5px; border-radius: 5px; font-size: 10px; font-weight: 700; }
.mc-t { background: #dcfce7; color: #166534; padding: 1px 5px; border-radius: 5px; font-size: 10px; font-weight: 700; }
.mc-n { color: #cbd5e1; font-size: 10px; }
.sum-row td { background: #f8fafc; font-weight: 700; }

/* Memar stat cards */
.m-stat-card { background: #fff; border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 14px; }
.m-stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.pline { height: 7px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.pline-fill { height: 100%; background: linear-gradient(90deg,#059669,#10b981); border-radius: 4px; }

/* Log */
.log-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 12px; }
.log-time { color: #94a3b8; font-size: 10px; white-space: nowrap; min-width: 120px; }
.log-who  { color: #1e40af; font-weight: 700; min-width: 80px; }

/* Video modal */
.video-wrap { border-radius: 10px; overflow: hidden; background: #000; margin: 12px 0; }
.video-wrap video { width: 100%; max-height: 380px; display: block; }

/* Loading */
.loading { text-align: center; padding: 50px; color: #94a3b8; font-size: 13px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
    .page-header { padding: 10px 14px; }
    .page-body { padding: 10px 12px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-input { max-width: 100%; }
    .target-grid { grid-template-columns: 1fr; }
    .modal { padding: 18px; }
}
