:root {
  --brand: #1747d1;
  --brand-dark: #0f34a3;
  --brand-soft: #e8eeff;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #121826;
  --muted: #667085;
  --border: #e3e8f0;
  --ok: #12a150;
  --ok-soft: #e3f7ec;
  --err: #d92d20;
  --err-soft: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.04);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5b84ff;
    --brand-dark: #7d9dff;
    --brand-soft: #1b2547;
    --bg: #0d1117;
    --surface: #161b24;
    --text: #e6e9ef;
    --muted: #8b95a7;
    --border: #262e3b;
    --ok-soft: #10301f;
    --err-soft: #3a1513;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
/* hidden özniteliği, display tanımlayan sınıflara (ör. .alert) rağmen her zaman gizlesin */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 26px; }
h3 { font-size: 17px; }
h4 { font-size: 14px; margin-top: 16px; }
a { color: var(--brand); }
p { margin: 0 0 12px; line-height: 1.5; }
code, .mono { font-family: 'Cascadia Code', Consolas, monospace; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.ok-text { color: var(--ok); }
.err-text { color: var(--err); }
.center { display: grid; place-items: center; min-height: 60vh; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 8px; }
.logo-text { font-size: 20px; font-weight: 600; color: var(--text); letter-spacing: -0.3px; }
.logo-text b { color: var(--brand); font-weight: 800; }

/* ---------- Admin paneli düzeni: sol menü + üst navbar + içerik ---------- */
:root {
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --navbar-h: 64px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(148, 163, 184, 0.1);
  --sidebar-active: #1e2a4a;
}
.icon { flex-shrink: 0; display: block; }

.app { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1100; width: var(--sidebar-w);
  display: flex; flex-direction: column; background: var(--sidebar-bg); color: var(--sidebar-text);
  transition: width 0.2s ease, transform 0.2s ease; overflow: hidden;
}
.sidebar-brand {
  height: var(--navbar-h); display: flex; align-items: center; padding: 0 22px; text-decoration: none;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12); flex-shrink: 0;
}
.sidebar .logo-text { color: #fff; white-space: nowrap; }
.sidebar .logo-text b { color: #8fb0ff; }
.side-nav { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: #64748b; padding: 16px 12px 8px; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--sidebar-text); text-decoration: none; font-size: 14px; font-weight: 500;
  white-space: nowrap; position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: #8fb0ff;
}
.nav-item.active .icon { color: #8fb0ff; }
.nav-ext { margin-left: auto; opacity: 0.6; }
.nav-ext .icon { width: 14px; height: 14px; }
.sidebar-foot { padding: 16px; flex-shrink: 0; }
.sidebar-tip {
  padding: 14px; border-radius: 12px; font-size: 13px; line-height: 1.45; white-space: nowrap;
  background: linear-gradient(135deg, #1d3fa8, #1747d1); color: #dbe5ff; display: flex; flex-direction: column;
}
.sidebar-tip b { color: #fff; }
.sidebar-backdrop { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left 0.2s ease; }

.navbar {
  position: sticky; top: 0; z-index: 1000; height: var(--navbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; padding: 0;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 15px; min-width: 0; white-space: nowrap; overflow: hidden; }
.crumb-sep { color: var(--border); }
.navbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.navbar .btn .icon { width: 16px; height: 16px; }

.user-menu { position: relative; }
.user-menu summary {
  list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid transparent;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { border-color: var(--border); background: var(--surface); }
.user-menu summary .icon { width: 16px; height: 16px; color: var(--muted); }
.user-name { font-size: 14px; font-weight: 600; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #5b84ff, #1747d1); color: #fff; font-size: 13px; font-weight: 700;
}
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14);
}
.menu-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 14px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head .muted { word-break: break-all; }
.menu form { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px;
  border: none; background: none; color: var(--text); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; text-align: left;
}
.menu-item .icon { width: 18px; height: 18px; color: var(--muted); }
.menu-item:hover { background: var(--bg); }
.menu-item.danger, .menu-item.danger .icon { color: var(--err); }

.content { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 28px 64px; }
.content > .flash { flex-direction: row; align-items: center; margin-bottom: 20px; }
.content > .flash .icon { width: 18px; height: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head p { max-width: 720px; }
.page-head .btn .icon { width: 16px; height: 16px; }

/* Masaüstünde daraltılmış menü: yalnızca ikonlar */
@media (min-width: 961px) {
  .sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
  .sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
  .sidebar-collapsed .sidebar-brand { padding: 0; justify-content: center; }
  .sidebar-collapsed .sidebar .logo-text,
  .sidebar-collapsed .nav-item span,
  .sidebar-collapsed .sidebar-foot { display: none; }
  .sidebar-collapsed .nav-section { font-size: 0; padding: 10px 0; border-top: 1px solid rgba(148, 163, 184, 0.12); margin: 6px 8px 0; }
  .sidebar-collapsed .nav-section:first-child { border-top: none; }
  .sidebar-collapsed .nav-item { justify-content: center; padding: 12px; }
}

/* ---------- Özet kartları (dashboard) ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi { display: flex; gap: 14px; align-items: center; padding: 18px 20px; }
.card.kpi + .card.kpi { margin-top: 0; }
.kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-icon.blue { background: var(--brand-soft); color: var(--brand); }
.kpi-icon.green { background: var(--ok-soft); color: var(--ok); }
.kpi-icon.violet { background: color-mix(in srgb, #7c3aed 14%, transparent); color: #7c3aed; }
.kpi-icon.amber { background: color-mix(in srgb, #d97706 14%, transparent); color: #d97706; }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 14px; }
.section-head h2 { font-size: 18px; margin: 0; }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.dash .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card.recent { padding: 6px 18px; }
.recent .list-row { padding: 11px 0; }
.recent-foot { display: block; text-align: center; padding: 12px 0; font-size: 13px; font-weight: 600; text-decoration: none; border-top: 1px solid var(--border); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: start; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card + .card, .card + .grid, .grid + .card { margin-top: 16px; }
.grid > .card { margin-top: 0; }
.card.empty { text-align: center; padding: 40px 20px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--bg); }
.btn.danger { color: var(--err); border-color: var(--err-soft); }
.btn.danger:hover { background: var(--err-soft); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.push-right { margin-left: auto; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .demo-settings label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; flex: 1; min-width: 0; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.row { display: flex; gap: 12px; }
.row.four > label { min-width: 0; }
input, select, textarea {
  font: inherit; font-size: 15px; font-weight: 400; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 100%;
}
input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--brand); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1; }

.alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.alert.error { background: var(--err-soft); color: var(--err); }
.alert.info { background: var(--brand-soft); color: var(--text); }

/* ---------- Address code ---------- */
.code-chip {
  display: inline-block; font-family: 'Cascadia Code', Consolas, monospace; font-weight: 700;
  font-size: 22px; letter-spacing: 2px; padding: 10px 16px; margin: 14px 0;
  border-radius: 10px; background: var(--brand-soft); color: var(--brand); border: 1px dashed var(--brand);
}
.code-chip.inline { font-size: 14px; padding: 2px 8px; margin: 0; letter-spacing: 1px; }
.code-chip.big { font-size: 30px; margin-top: 20px; }

.address-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.address-title { font-size: 17px; font-weight: 700; }
.status-pill {
  border: none; border-radius: 999px; padding: 5px 10px; font: inherit; font-size: 12px; font-weight: 600;
  white-space: nowrap; cursor: pointer;
}
span.status-pill { cursor: default; }
.status-pill.on { background: var(--ok-soft); color: var(--ok); }
.status-pill.off { background: var(--err-soft); color: var(--err); }

/* ---------- Address form ---------- */
.address-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.address-form .card + .card { margin-top: 0; }
.form-footer { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px; }
.map-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
/* position+z-index: Leaflet katmanları (z-index 400-1000) yapışkan navbar'ın üstüne çıkmasın */
.map { border-radius: 10px; overflow: hidden; border: 1px solid var(--border); margin-bottom: 10px; position: relative; z-index: 0; }
.map-pin { background: none; border: none; }

/* ---------- Permissions matrix ---------- */
.table-wrap { overflow-x: auto; padding: 0; }
.matrix { width: 100%; border-collapse: collapse; font-size: 14px; }
.matrix th, .matrix td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.matrix th { font-weight: 600; background: var(--bg); }
.matrix tr:last-child td { border-bottom: none; }
.company-cell { font-weight: 600; }
.center-cell { text-align: center !important; }
.matrix th:not(:first-child):not(:last-child) { text-align: center; }
.tag { display: inline-block; font-size: 11px; padding: 2px 6px; border-radius: 6px; margin-top: 4px; }
.tag.off { background: var(--err-soft); color: var(--err); }
.toggle {
  width: 44px; height: 24px; border-radius: 999px; border: none; background: var(--border);
  position: relative; cursor: pointer; transition: background 0.15s; padding: 0;
}
.toggle span {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.toggle.on { background: var(--ok); }
.toggle.on span { transform: translateX(20px); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.card.list { padding: 4px 20px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--err); }

/* ---------- Developer ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: var(--bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 11px; color: var(--muted); }
.stat b { font-size: 20px; }
pre.code {
  background: #0d1117; color: #e6edf3; padding: 14px 16px; border-radius: 10px; overflow-x: auto;
  font-size: 13px; line-height: 1.55;
}
code.secret { word-break: break-all; font-size: 14px; background: var(--surface); padding: 6px 8px; border-radius: 6px; }

/* ---------- Demo store ---------- */
.demo { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.demo .card + .card { margin-top: 0; }
.checkout-head { display: flex; justify-content: space-between; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.code-input { font-size: 18px; letter-spacing: 1px; }
.resolved {
  margin-top: 16px; padding: 16px; border-radius: 10px; border: 1px solid var(--ok); background: var(--ok-soft);
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
}
.resolved .btn { margin-top: 10px; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  padding: 64px; display: flex; flex-direction: column; justify-content: center; gap: 16px;
  background: linear-gradient(140deg, var(--brand-soft), var(--bg));
}
.auth-hero h1 { font-size: 36px; letter-spacing: -0.5px; margin-top: 24px; }
.auth-hero p { font-size: 17px; color: var(--muted); max-width: 520px; }
.auth-hero .code-chip { align-self: flex-start; }
.auth-card { align-self: center; justify-self: center; width: min(420px, calc(100% - 32px)); margin: 32px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .address-form, .demo, .auth-page { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 20px; }
  .auth-hero h1 { font-size: 26px; }
  .row { flex-direction: column; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .page-head { flex-direction: column; }
}

/* Tablet ve mobil: menü soldan kayarak açılır */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .dash { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, 0.35); }
  .sidebar-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 1050; background: rgba(15, 23, 42, 0.45);
  }
  .main { margin-left: 0; }
  .navbar { padding: 0 16px; }
  .content { padding: 20px 16px 48px; }
}
@media (max-width: 600px) {
  .hide-sm { display: none !important; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; flex-direction: column; align-items: flex-start; gap: 10px; }
  .kpi-icon { width: 38px; height: 38px; }
  .kpi-value { font-size: 22px; }
}

/* ---------- Razor Pages ekleri ---------- */
.alert.success { background: var(--ok-soft); color: var(--ok); }
.validation-summary-valid { display: none; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.field-error { color: var(--err); font-size: 12px; font-weight: 500; }
.field-error:empty { display: none; }
.input-validation-error { border-color: var(--err); }
details.qr { margin-bottom: 12px; display: block; }
details.qr summary { list-style: none; margin-bottom: 10px; }
details.qr summary::-webkit-details-marker { display: none; }
.qr-body { display: flex; gap: 14px; align-items: center; }
.qr-body img { border-radius: 8px; background: #fff; flex-shrink: 0; image-rendering: pixelated; }
.address-form .form-footer { flex-direction: row; }
.grid .stats { grid-template-columns: repeat(2, 1fr); }

/* ---------- Profil ---------- */
img.avatar { object-fit: cover; padding: 0; background: var(--border); }
.avatar.xl { width: 112px; height: 112px; font-size: 38px; }
.profile { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
.profile-main { display: flex; flex-direction: column; gap: 16px; }
.profile-main .card + .card { margin-top: 0; }
.profile-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; position: sticky; top: calc(var(--navbar-h) + 24px); }
.profile-card form { margin: 0; }
.profile-avatar { margin: 6px 0 10px; }
.profile-avatar img {
  width: 112px; height: 112px; border-radius: 50%; object-fit: cover; display: block;
  box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--brand-soft);
}
.profile-name { font-size: 18px; font-weight: 700; }
.avatar-form { display: flex; gap: 8px; justify-content: center; margin-top: 14px !important; }
.file-btn { cursor: pointer; }
.profile-card > p { margin: 8px 0 0; }
.danger-zone { border-color: color-mix(in srgb, var(--err) 35%, var(--border)); }
.danger-zone h3 { color: var(--err); }
.btn.danger-solid { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-solid:hover { background: #b42318; color: #fff; }
@media (max-width: 960px) {
  .profile { grid-template-columns: 1fr; }
  .profile-card { position: static; }
}
