/* Özduru Property CRM — internal admin styling. Brand: navy #0F2343 + gold #C9A227. */

:root {
	--navy: #0f2343;
	--navy-700: #1b3560;
	--gold: #c9a227;
	--gold-600: #b08e1f;
	--ink: #1d2433;
	--muted: #6b7482;
	--dim: #8b94a3;
	--line: #e6e9ef;
	--line-2: #eef1f6;
	--paper: #ffffff;
	--cream: #f7f7f4;
	--bg: #f4f5f8;
	--danger: #b32d2e;
	--danger-bg: #fdecec;
	--amber: #b7791f;
	--amber-bg: #fbf3e2;
	--green: #1f7a4d;
	--green-bg: #e7f4ec;
	--blue: #23557d;
	--blue-bg: #e8f0f7;
	--radius: 10px;
	--shadow: 0 1px 2px rgba(15, 35, 67, .06), 0 6px 18px rgba(15, 35, 67, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: var(--ink);
	background: var(--bg);
	font-size: 14px;
	line-height: 1.5;
}

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.main { padding-top: 22px; padding-bottom: 60px; }

h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 14px; font-weight: 700; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.muted { color: var(--muted); font-weight: 500; }
.dim { color: var(--dim); }

/* ---- Top bar ---- */
.topbar { background: var(--navy); color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { display: block; height: 40px; width: auto; }
.brand-tag { color: var(--gold); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { color: rgba(255, 255, 255, .85); font-weight: 500; }
.topnav a:hover { color: #fff; text-decoration: none; }
.topnav .who { color: rgba(255, 255, 255, .6); font-size: 13px; }

/* ---- Buttons ---- */
.btn {
	display: inline-flex; align-items: center; justify-content: center;
	gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
	font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
	transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-700); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: #cfd5df; background: #fbfbfc; }
.btn-block { width: 100%; }
.btn-mini { padding: 4px 10px; font-size: 12px; background: #fff; color: var(--navy); border-color: var(--line); }
.btn-mini:hover { border-color: #cfd5df; }
.topnav .btn-ghost { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .18); }
.topnav .btn-ghost:hover { background: rgba(255, 255, 255, .18); }

/* ---- Flash ---- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash-ok { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--danger-bg); color: var(--danger); }

/* ---- Login ---- */
.login-body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; min-height: 100vh; background: var(--navy); }
.login-card { background: #fff; padding: 34px 30px; border-radius: 14px; width: 340px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.login-logo { display: block; width: 260px; max-width: 80vw; height: auto; }
.login-tag { color: var(--gold); font-weight: 700; font-size: 12px; letter-spacing: .18em; text-transform: uppercase; }
.login-form label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
.login-form input { width: 100%; margin-top: 6px; }

/* ---- Forms / inputs ---- */
input[type="text"], input[type="search"], input[type="password"], input[type="date"], select, textarea {
	font: inherit; font-size: 14px; color: var(--ink); background: #fff;
	border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .15); }
textarea { width: 100%; resize: vertical; }
select { cursor: pointer; }

/* ---- Page head + status chips ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.status-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 20px; background: #fff; border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.chip:hover { border-color: #cfd5df; text-decoration: none; }
.chip b { color: var(--ink); }
.chip-on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-on b { color: var(--gold); }

/* ---- Filter bar ---- */
.filters { display: flex; flex-direction: column; gap: 11px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; box-shadow: var(--shadow); }

/* Full-width search row */
.filter-search { position: relative; display: flex; align-items: center; }
.filter-search .fs-icon { position: absolute; left: 15px; width: 18px; height: 18px; color: var(--dim); pointer-events: none; }
.filter-search .f-search { width: 100%; padding: 13px 84px 13px 44px; font-size: 15px; border-radius: 10px; }
.filter-search .f-search::-webkit-search-cancel-button { -webkit-appearance: none; }
.filter-search .fs-btn { position: absolute; right: 6px; top: 6px; bottom: 6px; padding: 0 20px; border: 0; border-radius: 8px; background: var(--navy); color: #fff; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: background .12s; }
.filter-search .fs-btn:hover { background: var(--navy-700); }

/* Compact filter row */
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filter-row select { flex: 0 1 auto; max-width: 160px; padding: 7px 28px 7px 11px; font-size: 13px; font-weight: 500; color: var(--muted); }
.filter-row select:focus { color: var(--ink); }
.filter-clear { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.filter-clear:hover { color: var(--danger); text-decoration: none; }

@media (max-width: 600px) {
	.filter-row select { flex: 1 1 calc(50% - 4px); max-width: none; }
	.filter-clear { margin-left: 0; width: 100%; text-align: center; padding-top: 2px; }
}

/* ---- Table ---- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.leads { width: 100%; border-collapse: collapse; }
table.leads thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 11px 14px; background: var(--cream); border-bottom: 1px solid var(--line); }
table.leads tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.leads tbody tr { cursor: pointer; }
table.leads tbody tr:hover { background: #fafbfc; }
table.leads tbody tr:last-child td { border-bottom: none; }
.c-name .name { font-weight: 600; color: var(--ink); }
.c-name .contact { margin-top: 3px; display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; color: var(--muted); }
.c-name .contact .dim { color: var(--dim); }
.c-tags { max-width: 180px; }
.c-note { max-width: 240px; font-size: 12.5px; }
.c-src { font-size: 13px; }
.c-date { white-space: nowrap; font-size: 12.5px; }

/* ---- Badges (status) ---- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-new { background: var(--blue-bg); color: var(--blue); }
.b-progress { background: var(--amber-bg); color: var(--amber); }
.b-won { background: var(--green-bg); color: var(--green); }
.b-closed { background: #eef0f3; color: var(--muted); }

/* ---- Pills (tags) ---- */
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; margin: 2px 3px 2px 0; background: #eef0f3; color: var(--muted); }
.pill-ilgili { background: var(--green-bg); color: var(--green); }
.pill-ilgisiz { background: #eef0f3; color: var(--muted); }
.pill-sicak { background: #fdeee7; color: #b4531f; }
.pill-soguk { background: var(--blue-bg); color: var(--blue); }
.pill-takipte { background: #f6efd9; color: var(--gold-600); }

/* ---- Reminder cell states ---- */
.rem { font-weight: 600; white-space: nowrap; }
.rem.overdue, .rem-item.overdue .rem-date { color: var(--danger); }
.rem.due-today, .rem-item.due-today .rem-date { color: var(--amber); }

/* ---- Pager ---- */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.pager-info { color: var(--muted); font-weight: 600; font-size: 13px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.empty h1 { font-size: 40px; color: var(--navy); }

/* ---- Lead detail ---- */
.crumb { margin: 4px 0 10px; }
.lead-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.lead-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.lead-side { display: flex; flex-direction: column; gap: 20px; }
.lead-main { display: flex; flex-direction: column; gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }

.stack { display: flex; flex-direction: column; gap: 10px; }
.stack select { width: 100%; }

.quick-actions { display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap; }
.qa { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: #fff; line-height: 1; transition: filter .12s, transform .04s; }
.qa:hover { color: #fff; text-decoration: none; filter: brightness(1.07); }
.qa:active { transform: translateY(1px); }
.qa svg { width: 15px; height: 15px; display: block; }
.qa-call { background: #2563eb; }
.qa-whatsapp { background: #1da851; }
.qa-mail { background: #e2683c; }

/* Hazır e-posta şablonları */
.mailtpl-intro { margin: -4px 0 14px; color: var(--muted); font-size: 13px; }
.mailtpl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mailtpl-chip {
	font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
	padding: 9px 16px; border-radius: 8px; background: #fff;
	border: 1px solid var(--line); color: var(--navy); line-height: 1.2;
	transition: border-color .12s, background .12s, box-shadow .12s, color .12s;
}
.mailtpl-chip:hover { border-color: var(--gold); background: #fffdf6; box-shadow: var(--shadow); }
.mailtpl-chip.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (max-width: 480px) {
	.mailtpl-chips { flex-direction: column; align-items: stretch; }
	.mailtpl-chip { text-align: center; }
}

/* Inline mail editor (çiplerin altında açılır) */
.mt-editor { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.mt-editor[hidden] { display: none; }
.mt-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.mt-editor-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.mt-x { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--dim); cursor: pointer; padding: 0 4px; }
.mt-x:hover { color: var(--ink); }
.mt-to-line { font-size: 12.5px; color: var(--muted); margin: 0 0 12px; }
.mt-to-line b { color: var(--ink); font-weight: 600; }
.mt-field { display: block; margin-bottom: 12px; }
.mt-field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.mt-subject { width: 100%; }

/* highlight-overlay: parantezli alanları renklendirmek için textarea + arka katman */
.mt-hl-wrap { display: block; position: relative; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.mt-hl-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .15); }
.mt-body, .mt-highlights {
	font: inherit; font-size: 14px; line-height: 1.6;
	padding: 10px 12px; margin: 0; border: 0; width: 100%; box-sizing: border-box;
	white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word;
}
.mt-highlights { position: absolute; inset: 0; color: var(--ink); pointer-events: none; overflow: hidden; }
.mt-body { position: relative; z-index: 1; display: block; resize: none; overflow: hidden; background: transparent; color: transparent; caret-color: var(--ink); outline: none; }
.mt-ph { background: #ffdf7e; color: #7a5300; border-radius: 3px; box-shadow: 0 0 0 1px #efc451; }
.mt-hint { margin: 8px 0 0; font-size: 12px; color: var(--dim); }
.mt-hint b { color: var(--amber); }
.mt-editor-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.mt-editor-foot .spacer { flex: 1; }
.btn-whatsapp { background: #1da851; color: #fff; border-color: #1da851; }
.btn-whatsapp:hover { background: #17974a; color: #fff; }

@media (max-width: 480px) {
	.mt-editor-foot .spacer { flex-basis: 100%; height: 0; }
	.mt-editor-foot .btn { flex: 1; }
}

table.kv { width: 100%; border-collapse: collapse; }
table.kv th { text-align: left; width: 88px; padding: 6px 10px 6px 0; color: var(--muted); font-weight: 600; vertical-align: top; font-size: 13px; }
table.kv td { padding: 6px 0; vertical-align: top; border-bottom: 1px solid var(--line-2); }
table.kv tr:last-child td { border-bottom: none; }
.wrap-any { word-break: break-all; }

/* Reminders */
.reminder-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.reminder-form .grow { flex: 1 1 160px; min-width: 140px; }
.reminder-list { list-style: none; margin: 0; padding: 0; }
.rem-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.rem-item:last-child { border-bottom: none; }
.rem-date { font-weight: 600; white-space: nowrap; min-width: 92px; }
.rem-note { flex: 1; color: var(--muted); }
.rem-item.done { opacity: .55; }
.rem-item.done .rem-date { text-decoration: line-through; }
.rem-tick { color: var(--green); font-size: 12px; font-weight: 600; }
.inline { display: inline; }

/* Notes */
.note-form { margin-bottom: 16px; }
.note-form textarea { margin-bottom: 8px; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-item { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.note-item:first-child { padding-top: 4px; }
.note-item:last-child { border-bottom: none; }
.note-meta { font-size: 12px; color: var(--dim); margin-bottom: 3px; font-weight: 500; }
.note-body { color: var(--ink); }

/* Tag checkboxes */
.tag-check { display: flex; flex-direction: column; gap: 8px; }
.tag-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.tag-opt input { margin: 0; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
	.lead-grid { grid-template-columns: 1fr; }
	.table-wrap { overflow-x: auto; }
	table.leads { min-width: 720px; }
}
