/* Changa admin — mockup tarzı (koyu varsayılan + açık tema) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
	--bg: #111827;
	--bg2: #1f2937;
	--bg3: #374151;
	--card: #1f2937;
	--border: #374151;
	--text: #f3f4f6;
	--text2: #9ca3af;
	--pri: #3b82f6;
	--pri-d: #2563eb;
	--success: #10b981;
	--danger: #ef4444;
	--warning: #f59e0b;
	--info: #06b6d4;
	--purple: #8b5cf6;
	--radius: 12px;
	--shadow: 0 4px 24px rgba(0,0,0,.3);
	--sidebar-w: 260px;
	/* uyumluluk */
	--top: var(--bg2);
	--muted: var(--text2);
	--ok: var(--success);
	--table-alt: transparent;
	--code-bg: var(--bg);
}

[data-theme="light"] {
	--bg: #f1f5f9;
	--bg2: #ffffff;
	--bg3: #e2e8f0;
	--card: #ffffff;
	--border: #e2e8f0;
	--text: #0f172a;
	--text2: #64748b;
	--pri: #2563eb;
	--pri-d: #1d4ed8;
	--success: #059669;
	--danger: #dc2626;
	--warning: #d97706;
	--info: #0891b2;
	--purple: #7c3aed;
	--shadow: 0 4px 20px rgba(15,23,42,.08);
	--table-alt: #f8fafc;
	--code-bg: #f1f5f9;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

body {
	font-family: Inter, system-ui, sans-serif;
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
	line-height: 1.45;
}

a { color: var(--pri); text-decoration: none; }
a:hover { color: var(--pri-d); }

/* —— Sidebar —— */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
	width: var(--sidebar-w);
	background: var(--bg2);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	position: fixed;
	height: 100vh;
	z-index: 100;
	transition: transform .3s;
}
.sidebar-header {
	padding: 22px 18px;
	border-bottom: 1px solid var(--border);
}
.sidebar-header h1 {
	font-size: 14px;
	font-weight: 700;
	color: var(--pri);
	letter-spacing: -.2px;
	line-height: 1.3;
}
.sidebar-header p {
	font-size: 11px;
	color: var(--text2);
	margin-top: 4px;
}
.nav-group-title {
	font-size: 0.68rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--text2);
	padding: 0.85rem 1rem 0.35rem;
	opacity: 0.85;
}
.sidebar-nav {
	flex: 1;
	padding: 10px 8px;
	overflow-y: auto;
}
.sidebar-nav a,
.sidebar-nav button.nav-item {
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 10px 12px;
	border-radius: 8px;
	color: var(--text2);
	font-size: 13.5px;
	font-weight: 500;
	cursor: pointer;
	transition: all .15s;
	margin-bottom: 2px;
	border: none;
	background: none;
	width: 100%;
	text-align: left;
	text-decoration: none;
	font-family: inherit;
}
.sidebar-nav a:hover,
.sidebar-nav button.nav-item:hover {
	background: var(--bg3);
	color: var(--text);
}
.sidebar-nav a.on,
.sidebar-nav a.active {
	background: var(--pri);
	color: #fff !important;
}
.sidebar-nav .nav-ico {
	width: 18px;
	text-align: center;
	font-size: 15px;
	flex-shrink: 0;
}
.sidebar-footer {
	padding: 14px 18px;
	border-top: 1px solid var(--border);
	font-size: 11px;
	color: var(--text2);
	line-height: 1.5;
}

/* —— Main —— */
.main {
	margin-left: var(--sidebar-w);
	flex: 1;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.topbar {
	background: var(--bg2);
	border-bottom: 1px solid var(--border);
	padding: 14px 24px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	position: sticky;
	top: 0;
	z-index: 50;
	flex-wrap: wrap;
}
.topbar h2 { font-size: 17px; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar .date-pill {
	font-size: 12px;
	color: var(--text2);
	background: var(--bg3);
	padding: 6px 12px;
	border-radius: 20px;
}
.menu-toggle {
	display: none;
	background: none;
	border: none;
	color: var(--text);
	cursor: pointer;
	padding: 4px;
	font-size: 1.25rem;
}
.theme-btn {
	border: 1px solid var(--border);
	background: var(--bg3);
	color: var(--text);
	border-radius: 999px;
	padding: 6px 12px;
	cursor: pointer;
	font-size: 14px;
}
.theme-btn:hover { border-color: var(--pri); }

.content-wrap { padding: 22px 24px; flex: 1; }
.lic-banner {
	padding: 8px 24px;
	font-size: 13px;
	border-bottom: 1px solid var(--border);
}
.lic-licensed { background: rgba(16,185,129,.12); color: var(--success); }
.lic-trial { background: rgba(245,158,11,.12); color: var(--warning); }
.lic-expired { background: rgba(239,68,68,.12); color: var(--danger); }

/* —— Cards / sections —— */
.card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 18px 20px;
	margin-bottom: 18px;
	box-shadow: none;
	color: var(--text);
}
.card h1, .card h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--text); }

.section {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	margin-bottom: 20px;
	overflow: hidden;
}
.section-header {
	padding: 14px 18px;
	border-bottom: 1px solid var(--border);
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.section-header h3 { font-size: 14px; font-weight: 600; margin: 0; }
.section-body { overflow-x: auto; }

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 14px;
	margin-bottom: 22px;
}
.stat-card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 18px;
	transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .label {
	font-size: 11px;
	font-weight: 600;
	color: var(--text2);
	text-transform: uppercase;
	letter-spacing: .4px;
	margin-bottom: 6px;
}
.stat-card .value {
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -.4px;
	color: var(--text);
}
.stat-card .sub { font-size: 12px; color: var(--text2); margin-top: 4px; }
.stat-card.green .value { color: var(--success); }
.stat-card.red .value { color: var(--danger); }
.stat-card.blue .value { color: var(--pri); }
.stat-card.orange .value { color: var(--warning); }
.stat-card.cyan .value { color: var(--info); }
.stat-card.purple .value { color: var(--purple); }

/* legacy grid/stat */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat {
	background: var(--card);
	border: 1px solid var(--border);
	color: var(--text);
	border-radius: var(--radius);
	padding: 1rem;
}
.stat .n { font-size: 1.4rem; font-weight: 800; }
.stat .l { color: var(--text2); font-size: .8rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text); }
th {
	background: var(--bg3);
	text-align: left;
	padding: 10px 12px;
	font-weight: 600;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .35px;
	color: var(--text2);
	white-space: nowrap;
}
td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--border);
}
tr:hover td { background: rgba(59, 130, 246, 0.06); }
tr:nth-child(even) td { background: var(--table-alt); }
.totals-row td {
	background: var(--bg3) !important;
	font-weight: 700;
	border-top: 2px solid var(--border);
}

.badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 11px;
	font-weight: 600;
}
.badge.green { background: rgba(16,185,129,.15); color: var(--success); }
.badge.red { background: rgba(239,68,68,.15); color: var(--danger); }
.badge.blue { background: rgba(59,130,246,.15); color: var(--pri); }
.badge.orange { background: rgba(245,158,11,.15); color: var(--warning); }
.badge.gray { background: rgba(139,163,188,.15); color: var(--text2); }

/* Forms / buttons */
.btn {
	display: inline-block;
	background: var(--pri);
	color: #fff !important;
	border: 0;
	border-radius: 8px;
	padding: .45rem .9rem;
	font-weight: 600;
	cursor: pointer;
	font-size: .88rem;
	text-decoration: none !important;
	font-family: inherit;
}
.btn:hover { background: var(--pri-d); }
.btn-outline {
	background: transparent;
	color: var(--pri) !important;
	border: 1px solid var(--pri);
}
.btn-sm { padding: .25rem .55rem; font-size: .78rem; }
.btn-danger { background: var(--danger); }

.form-row {
	display: flex;
	flex-wrap: wrap;
	gap: .75rem;
	margin-bottom: .75rem;
	align-items: end;
}
label { display: block; font-size: .78rem; color: var(--text2); margin-bottom: .25rem; font-weight: 500; }
input, select, textarea {
	width: 100%;
	padding: .5rem .65rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	font: inherit;
	background: var(--bg);
	color: var(--text);
}
input:focus, select:focus, textarea:focus {
	outline: 0;
	border-color: var(--pri);
	box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}
.form-row > div { flex: 1; min-width: 120px; }

.alert { padding: .65rem .9rem; border-radius: 8px; margin-bottom: .75rem; font-size: .88rem; }
.alert-success { background: rgba(16,185,129,.12); color: var(--success); border: 1px solid rgba(16,185,129,.25); }
.alert-error, .alert-danger { background: rgba(239,68,68,.12); color: var(--danger); border: 1px solid rgba(239,68,68,.25); }
.alert-warning { background: rgba(245,158,11,.12); color: var(--warning); border: 1px solid rgba(245,158,11,.25); }
.alert-info { background: rgba(6,182,212,.12); color: var(--info); border: 1px solid rgba(6,182,212,.25); }

.login-box { max-width: 400px; margin: 3rem auto; }
.muted { color: var(--text2); font-size: .85rem; }
.paid { color: var(--success); }
.debt { color: var(--danger); font-weight: 600; }
code {
	font-size: .8rem;
	background: var(--code-bg);
	padding: .1rem .3rem;
	border-radius: 4px;
	word-break: break-all;
	color: var(--text);
}

.foot {
	text-align: center;
	padding: 1rem 1.25rem;
	color: var(--text2);
	font-size: .8rem;
	border-top: 1px solid var(--border);
	background: var(--bg2);
}

/* Dashboard modules */
.dash-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: .85rem;
}
.dash-tile {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: .35rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 1rem .9rem;
	text-decoration: none;
	color: var(--text);
	transition: transform .12s, border-color .12s;
	min-height: 110px;
}
.dash-tile:hover {
	transform: translateY(-2px);
	border-color: var(--pri);
	color: var(--text);
}
.dash-tile .ico {
	width: 42px; height: 42px;
	border-radius: 12px;
	display: flex; align-items: center; justify-content: center;
	font-size: 1.25rem;
	margin-bottom: .1rem;
}
.dash-tile .t { font-weight: 700; font-size: .9rem; color: var(--text); }
.dash-tile .d { font-size: .75rem; color: var(--text2); line-height: 1.35; }

.grid-2 {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}
@media (max-width: 1100px) {
	.grid-2 { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 900px) {
	.sidebar { transform: translateX(-100%); }
	.sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.4); }
	.main { margin-left: 0; }
	.menu-toggle { display: block; }
	.content-wrap { padding: 16px; }
	.cards { grid-template-columns: 1fr 1fr; }
}

/* Overlay when sidebar open on mobile */
.sidebar-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.45);
	z-index: 90;
}
.sidebar-backdrop.show { display: block; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Print: hide chrome */
@media print {
	.sidebar, .topbar, .lic-banner, .foot, .theme-btn, .menu-toggle, .no-print { display: none !important; }
	.main { margin-left: 0 !important; width: 100% !important; max-width: 100% !important; }
	.content-wrap { padding: 0 !important; max-width: 100% !important; }
	.app-shell { display: block !important; }
	body { background: #fff !important; color: #000 !important; }
	.card, .section { border: 0 !important; box-shadow: none !important; padding: 0 !important; background: #fff !important; }
	/* Tablo yazdırmada bozulmasın (ekranda display:block vardı) */
	.table-scroll,
	.card > table,
	.section-body,
	table {
		display: table !important;
		width: 100% !important;
		min-width: 0 !important;
		overflow: visible !important;
	}
	thead { display: table-header-group !important; }
	tbody { display: table-row-group !important; }
	tfoot { display: table-footer-group !important; }
	tr { display: table-row !important; page-break-inside: avoid; }
	th, td { display: table-cell !important; color: #000 !important; background: transparent !important; }
	.paid, .debt, a { color: #000 !important; }
	.debt { font-weight: 700 !important; text-decoration: underline; }
}

/* ========== Mobile & polish v1.6.8 ========== */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; }

/* Softer cards */
.card {
	border-radius: 14px;
	padding: 1rem 1.1rem;
}

/* Tables: always scrollable on small screens */
.table-scroll,
.card > table,
.section-body {
	display: block;
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
table { min-width: 520px; }
.bi-tbl { min-width: 0 !important; }
.bi-grid .bi-tbl { min-width: 0; }

/* Form touch targets */
input, select, textarea, .btn {
	min-height: 42px;
	font-size: 16px; /* iOS zoom önleme */
}
.btn-sm { min-height: 34px; font-size: 13px; }
label { margin-bottom: .3rem; }

/* Topbar mobile */
@media (max-width: 900px) {
	:root { --sidebar-w: 280px; }
	.topbar {
		padding: 12px 14px;
		position: sticky;
		top: 0;
	}
	.topbar h2 {
		font-size: 15px;
		max-width: 55vw;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}
	.topbar .date-pill { display: none; }
	.content-wrap { padding: 12px 12px 88px; }
	.lic-banner { font-size: 12px; padding: 8px 12px; }

	.cards {
		grid-template-columns: 1fr 1fr;
		gap: 10px;
	}
	.stat-card { padding: 14px; }
	.stat-card .value { font-size: 17px; }
	.stat-card .label { font-size: 10px; }

	.form-row { flex-direction: column; align-items: stretch; gap: .65rem; }
	.form-row > div { min-width: 0; width: 100%; }

	.dash-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
	.dash-tile { min-height: 100px; padding: .85rem .7rem; }

	.bi-grid { grid-template-columns: 1fr; gap: 1.25rem; }
	table { font-size: 12px; min-width: 480px; }
	th, td { padding: 8px 8px; }

	.sidebar-header h1 { font-size: 13px; }
	.sidebar-nav a { padding: 12px 14px; font-size: 14px; min-height: 44px; }

	.az-layout { grid-template-columns: 1fr !important; }
	.az-side { position: static !important; }
	.az-save { position: static; margin-top: 1rem; }
}

@media (max-width: 480px) {
	.cards { grid-template-columns: 1fr; }
	.stat-card .value { font-size: 20px; }
	.dash-grid { grid-template-columns: 1fr 1fr; }
	.btn { width: 100%; text-align: center; }
	p .btn, td .btn, .form-row .btn, .az-save .btn {
		width: auto;
	}
	td .btn-sm { width: auto; display: inline-block; }
}

/* Bottom safe area for notched phones */
@supports (padding: max(0px)) {
	.content-wrap {
		padding-bottom: max(24px, env(safe-area-inset-bottom));
	}
}

/* Print toolbar compact on mobile */
@media (max-width: 600px) {
	.no-print .form-row { gap: .5rem; }
}
