:root {
    --bg: #0a0a0a;
    --surface: #131317;
    --surface-2: #1a1a20;
    --border: rgba(255, 255, 255, 0.08);
    --text: #f3f4f6;
    --muted: #9ca3af;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-soft: rgba(99, 102, 241, 0.16);
    --mark: #818cf8;
    --danger: #ef4444;
    --ok: #22c55e;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { background: var(--bg); color: var(--text); min-height: 100vh; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.grow { flex: 1; }
.err { color: #fca5a5; font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #22222a; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { background: rgba(239, 68, 68, 0.1); color: #f87171; border-color: rgba(239, 68, 68, 0.25); }
.btn.danger.confirm { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; text-decoration: none; font-size: 15px; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

input, select { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border); background: #0e0e12; color: var(--text); font-size: 15px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
select { width: auto; cursor: pointer; }

/* Giriş */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 50% 30%, rgba(99, 102, 241, 0.14), transparent 60%); }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px 22px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-icon { margin: 0 auto; border-radius: 16px; }
.login-card h1 { font-size: 20px; }
.pw-field { position: relative; }
.pw-field input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); width: 36px; height: 36px; cursor: pointer; }
.back { text-decoration: none; }

/* Üst */
.app { max-width: 1100px; margin: 0 auto; padding-bottom: 40px; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: rgba(10, 10, 10, 0.88); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.brand img { border-radius: 7px; }
.brand b { color: #a5b4fc; }
.top-actions { display: flex; gap: 8px; }

.tabs { display: flex; gap: 6px; padding: 12px 16px 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--accent-soft); color: #c7d2fe; border-color: rgba(99, 102, 241, 0.35); }

.content { padding: 16px; }
.section-title { font-size: 15px; font-weight: 700; margin: 6px 0 12px; }
.section-title + .tiles { margin-bottom: 26px; }

/* Kutucuklar */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.tile .label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile .value { font-size: 26px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Araç çubuğu ve listeler */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 220px; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.search input { padding-left: 34px; }
.list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; }
.row:hover { border-color: rgba(99, 102, 241, 0.35); }
.row img { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #fff; flex-shrink: 0; }
.row .ph { width: 44px; height: 44px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.row .main { flex: 1; min-width: 0; }
.row .name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.row .right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.row .actions { display: flex; gap: 6px; flex-shrink: 0; }
.chip { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 100px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.chip.off { color: #86efac; border-color: rgba(34, 197, 94, 0.3); }
.chip.kullanici { color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
.chip.yonetici { color: #a5b4fc; border-color: rgba(99, 102, 241, 0.35); }
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; font-size: 14px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; color: var(--muted); }

/* Grafik */
.chart-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 10px 6px; margin-bottom: 14px; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart .grid line { stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--mark); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .bar, .chart .bar.on { fill: #a5b4fc; }
.chart-tip { position: absolute; pointer-events: none; background: #0e0e12; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; white-space: nowrap; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); transform: translate(-50%, -100%); z-index: 3; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 10px 12px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.tbl tr + tr td { border-top: 1px solid rgba(255, 255, 255, 0.04); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.6); }
.modal-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px 20px 0 0; padding: 18px; padding-bottom: max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; max-height: 92dvh; overflow-y: auto; }
@media (min-width: 600px) { .modal { align-items: center; padding: 16px; } .modal-card { border-radius: 20px; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 17px; }
.modal-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.modal-card label input { color: var(--text); }
.modal-actions { display: flex; gap: 8px; justify-content: space-between; margin-top: 4px; }
.modal-actions .btn { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #1e1e24; border: 1px solid var(--border); padding: 10px 16px; border-radius: 100px; font-size: 13px; opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 100; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
    .tab span { display: none; }
    .tab { flex: 1; justify-content: center; padding: 11px 0; font-size: 16px; }
    .tab.active span { display: inline; font-size: 13px; }
    .toolbar select { flex: 1; }
    #btn-add { flex: 1 1 100%; }
}

/* İmza: code by dagasan */
.signature { display: flex; justify-content: center; padding: 28px 0 8px; user-select: none; }
.signature.sm { padding: 4px 0 0; }
.sig-svg { display: block; height: 30px; width: auto; overflow: visible; opacity: 0.85; filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.22)); }
.signature.sm .sig-svg { height: 22px; opacity: 0.7; }
