/* =====================================================================
   TTYD Dijital Kartvizit
   ttyd.org.tr görsel dili: lacivert #041332 + kırmızı #C41E3A, kalın düz başlıklar, Selçuklu yıldızı deseni
   ===================================================================== */

:root {
  --navy: #041332;
  --navy-2: #052244;
  --blue: #2563eb;
  --brand: #c41e3a;
  --brand-hi: #e0485f;
  --brand-lo: #a8182f;

  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #56657a;
  --brand-text: #c41e3a;
  --focus: #c41e3a;
  --control-border: #94a3b8;
  --on-accent: #fff;
  --danger: #c2410c;
  --danger-strong: #b91c1c;
  --ok: #047857;

  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(11, 21, 48, .05);
  --shadow: 0 1px 2px rgba(11, 21, 48, .05), 0 10px 30px -12px rgba(11, 21, 48, .14);
  --shadow-lg: 0 2px 4px rgba(11, 21, 48, .04), 0 30px 80px -30px rgba(11, 21, 48, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);

  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Sekiz köşeli yıldız (iki kare) deseni */
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='white' stroke-width='1'%3E%3Crect x='20' y='20' width='24' height='24'/%3E%3Crect x='20' y='20' width='24' height='24' transform='rotate(45 32 32)'/%3E%3Cpath d='M0 32h6M58 32h6M32 0v6M32 58v6'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #050b1a;
    --surface: #0c1630;
    --surface-2: #101d3b;
    --border: #1c2a4b;
    --border-2: #2a3a60;
    --text: #eef1f8;
    --text-2: #b9c3d8;
    --muted: #8a96b0;
    --brand-text: #f0738a;
    --focus: #f0738a;
    --control-border: #4a5b85;
    --danger: #f97316;
    --danger-strong: #f87171;
    --ok: #34d399;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #050b1a; --surface: #0c1630; --surface-2: #101d3b; --border: #1c2a4b; --border-2: #2a3a60;
  --text: #eef1f8; --text-2: #b9c3d8; --muted: #8a96b0; --danger: #f97316; --ok: #34d399;
  --brand-text: #f0738a; --focus: #f0738a; --control-border: #4a5b85; --danger-strong: #f87171;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
.ic { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
label.btn { position: relative; }
label.btn:has(.sr-file:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Giriş animasyonu */
.rise { animation: rise .7s var(--ease) both; animation-delay: calc(var(--d, 0) * 60ms + 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Arka plan ışıkları */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40vmax 40vmax at 0% 0%, color-mix(in srgb, var(--accent, var(--navy)) 16%, transparent), transparent 70%),
    radial-gradient(36vmax 36vmax at 100% 100%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%);
}

/* ---------------------------------------------------------------- Ortak butonlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 8px;
  font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1; text-decoration: none; white-space: nowrap;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, filter .2s;
}
.btn:active { transform: scale(.98); }
.btn-accent {
  color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent, var(--navy)) 82%, #fff), var(--accent, var(--navy)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 6px 16px -6px color-mix(in srgb, var(--accent, var(--navy)) 70%, transparent);
}
.btn-accent:hover { filter: brightness(1.12); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--border-2); background: var(--surface-2); }
.btn-dashed { background: transparent; color: var(--text-2); border: 1.5px dashed var(--border-2); min-height: 48px; }
.btn-dashed:hover { color: var(--text); border-color: var(--brand); }
.btn-danger { background: #b91c1c; color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
.btn-block { width: 100%; }

.icon-btn {
  position: relative; z-index: 1;
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }
.icon-btn.danger:hover { color: var(--danger-strong); border-color: currentColor; }

.ornament { display: block; width: 64px; height: 4px; margin: 16px auto 0; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 15%, transparent)); }
.ornament span, .ornament i { display: none; }

/* ================================================================= KART */
.page-card { min-height: 100vh; padding: 0 0 40px; }
.card {
  --accent: var(--navy);
  position: relative; max-width: 460px; margin: 0 auto; padding: 0 18px 4px;
}
@media (min-width: 520px) {
  .page-card { padding: 40px 16px 56px; }
  .card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border); }
}

/* Üst bölüm — sitedeki koyu lacivert geçiş (#041332 → #052244) */
.hero {
  position: relative; margin: 0 -18px; height: 200px; overflow: hidden;
  background:
    radial-gradient(80% 90% at 100% 0%, rgba(196, 30, 58, .22) 0%, transparent 55%),
    linear-gradient(135deg, #041332 0%, #052244 100%);
}
.hero::before {
  content: ""; position: absolute; inset: -64px 0 0 -64px;
  background-image: var(--pattern); background-size: 64px 64px; opacity: .08;
  -webkit-mask-image: radial-gradient(120% 100% at 50% 0%, #000 30%, transparent 85%);
  mask-image: radial-gradient(120% 100% at 50% 0%, #000 30%, transparent 85%);
  animation: drift 60s linear infinite;
}
@keyframes drift { to { transform: translate3d(64px, 64px, 0); } }
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), rgba(196, 30, 58, .15));
}
.hero-top { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 22px 0; }
.hero-logo { height: 38px; width: auto; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .25)); }
.glass-btn {
  width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
  color: #fff; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background .2s, transform .15s var(--ease);
}
.glass-btn:hover { background: rgba(255, 255, 255, .18); }
.glass-btn:active { transform: scale(.95); }

/* Kimlik */
.ident { position: relative; text-align: center; margin-top: -66px; }
.avatar-ring {
  width: 136px; height: 136px; margin: 0 auto; padding: 3px; border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--brand), 0 18px 40px -14px rgba(4, 19, 50, .55);
}
.avatar, .avatar-md, .avatar-sm, .avatar-xs { border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.avatar { width: 130px; height: 130px; }
.avatar-empty {
  display: grid; place-items: center; font-weight: 900; color: #fff; font-family: var(--display); letter-spacing: .02em;
  background: linear-gradient(135deg, #041332, #052244);
}
.avatar.avatar-empty { font-size: 42px; }
.ident h1 {
  margin: 18px 0 0; font-family: var(--display); font-weight: 900; font-size: 28px; line-height: 1.15;
  letter-spacing: -.015em; text-wrap: balance; color: var(--navy);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ident h1 { color: var(--text); } }
:root[data-theme="dark"] .ident h1 { color: var(--text); }
.role { margin: 6px 0 0; color: var(--text-2); font-weight: 500; font-size: 16px; text-wrap: balance; }
/* Sitedeki köşesiz, büyük harfli kırmızı etiket */
.org {
  display: inline-block; margin: 12px 0 0; padding: 6px 14px; border-radius: 0;
  font-size: 10.5px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  color: #fff; background: var(--brand);
}

/* Hızlı aksiyonlar */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; margin: 26px 0 0; }
.quick a {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 12px;
  border-radius: 10px; text-decoration: none; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.quick a:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.quick a:active { transform: scale(.97); }
.quick-ic {
  width: 46px; height: 46px; border-radius: 8px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #041332, #052244);
  box-shadow: 0 6px 14px -6px rgba(4, 19, 50, .7);
}
.quick a:hover .quick-ic { background: var(--brand); }
.quick-tx { font-size: 12.5px; font-weight: 600; color: var(--text-2); }

/* Ana çağrı — sitedeki kırmızı düğme */
.cta { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 12px; }
.btn-primary {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; border-radius: 8px;
  color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; letter-spacing: .08em; text-transform: uppercase;
  background: var(--brand); box-shadow: 0 10px 24px -12px rgba(196, 30, 58, .9);
  transition: transform .15s var(--ease), background .2s;
}
.btn-primary:hover { background: var(--brand-lo); }
.btn-primary:active { transform: scale(.98); }
.btn-square {
  width: 54px; height: 54px; border-radius: 8px; display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--navy); box-shadow: var(--shadow-sm);
  transition: border-color .2s, transform .15s var(--ease);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-square { color: var(--text); } }
.btn-square:hover { border-color: var(--brand); }
.btn-square:active { transform: scale(.95); }

/* Bölümler */
.sect { margin-top: 26px; }
.eyebrow {
  display: flex; align-items: center; gap: 10px; margin: 0 0 10px 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--brand-text);
}
.eyebrow::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.bio {
  margin: 0; padding: 18px 20px; font-size: 15.5px; line-height: 1.65; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--brand);
}
.rows, .links {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.row, .link {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 64px; text-decoration: none;
  transition: background .15s;
}
.row + .row, .link + .link { border-top: 1px solid var(--border); }
.row:hover, .link:hover { background: var(--surface-2); }
.row > .ic:last-child { color: var(--border-2); transition: transform .2s var(--ease), color .2s; }
.row:hover > .ic:last-child { color: var(--brand); transform: translateX(3px); }
.tile {
  width: 40px; height: 40px; border-radius: 8px; flex: none; display: grid; place-items: center;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tile { color: var(--brand-hi); background: color-mix(in srgb, var(--brand) 12%, transparent); border-color: color-mix(in srgb, var(--brand) 22%, transparent); }
}
:root[data-theme="dark"] .tile { color: var(--brand-hi); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.row-tx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-tx small { color: var(--muted); font-size: 12px; font-weight: 500; }
.row-tx span { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.link-tx { flex: 1; font-weight: 600; font-size: 15px; min-width: 0; overflow-wrap: anywhere; }
.link-go {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted);
  border: 1px solid var(--border); transition: all .2s var(--ease);
}
.link:hover .link-go { color: #fff; background: var(--brand); border-color: var(--brand); }

.socials { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 28px 0 0; }
.socials a {
  width: 48px; height: 48px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), color .2s, border-color .2s;
}
.socials a:hover { transform: translateY(-2px); color: var(--accent); border-color: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .socials a:hover { color: var(--brand-hi); } }

.foot { margin: 34px 0 18px; text-align: center; }
.foot a { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); font-size: 12px; }
.foot-logo { height: 26px; width: auto; opacity: .75; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .foot-logo { filter: invert(1); } }
:root[data-theme="dark"] .foot-logo { filter: invert(1); }

/* Admin önizleme şeridi */
.preview-bar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 16px; font-size: 13.5px; font-weight: 500; color: #fff;
  background: linear-gradient(90deg, var(--brand), #1d4ed8);
}
.preview-bar a { font-weight: 700; }
@media (min-width: 520px) {
  .page-card:has(.preview-bar) { padding-top: 0; }
  .page-card:has(.preview-bar) .preview-bar { margin: 0 -16px; }
  .preview-bar + .backdrop + .card { margin-top: 40px; }
}

/* Panel içi gömülü önizleme */
.is-embed { padding: 0 !important; }
html:has(> body.is-embed) { scrollbar-width: none; }
html:has(> body.is-embed)::-webkit-scrollbar { display: none; }
.is-embed .card { border-radius: 0; box-shadow: none; border: 0; background: transparent; max-width: none; }
.is-embed .rise { animation: none; }

/* QR penceresi */
.modal {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: start center; padding: 56px 16px 16px;
  overflow-y: auto; overscroll-behavior: contain;
  background: rgba(4, 12, 30, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } }
.modal-box {
  position: relative; width: 100%; max-width: 350px; margin: auto 0; padding: 30px 22px 22px; text-align: center;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: pop .3s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.modal-avatar { width: 64px; height: 64px; margin: -62px auto 10px; padding: 3px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--brand); }
.avatar-xs { width: 58px; height: 58px; border: 3px solid var(--surface); font-size: 20px; }
.modal-box h2 { margin: 0; font-family: var(--display); font-weight: 800; letter-spacing: -.015em; font-size: 22px; }
.modal-box p { margin: 4px 0 18px; font-size: 14px; }
.modal-x {
  position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border: 0; border-radius: 8px;
  background: var(--surface-2); color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.modal-x:hover { color: var(--text); }
.qr-frame {
  position: relative; margin: 0 auto 18px; max-width: min(250px, 55vh); padding: 10px; border-radius: 8px;
  background: linear-gradient(135deg, #041332, #052244);
}
.qr-box { background: #fff; border-radius: 6px; padding: 8px; }
.qr-box svg { display: block; width: 100%; height: auto; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); border: 1px solid rgba(255, 255, 255, .1);
  animation: toast-in .25s var(--ease) both;
}
.toast:empty { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px) scale(.97); } }

/* ================================================================= ORTALANMIŞ SAYFALAR */
.page-center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.center-box {
  position: relative; width: 100%; max-width: 400px; padding: 40px 28px 32px; text-align: center; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.center-box::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px;
  background: linear-gradient(90deg, var(--navy), var(--brand), var(--navy));
}
.center-logo { height: 48px; margin: 0 auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .center-logo { filter: invert(1); } }
:root[data-theme="dark"] .center-logo { filter: invert(1); }
.center-box .ornament { margin: 18px auto 16px; }
.center-box h1 { margin: 0 0 6px; font-family: var(--display); font-weight: 800; letter-spacing: -.015em; font-size: 27px; }
.center-box > p { margin: 0; }
.center-box > .btn { margin-top: 24px; }
.login-form { text-align: left; margin-top: 22px; display: grid; gap: 4px; }
.center-box .alert { margin: 18px 0 0; text-align: left; }

/* ================================================================= ADMIN */
.page-admin { --accent: var(--navy); }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; color: #fff;
  background: linear-gradient(90deg, #041332, #1e4a66);
  box-shadow: 0 1px 0 rgba(196, 30, 58, .35), 0 8px 24px -16px rgba(4, 19, 50, .7);
}
.topbar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .06;
  background-image: var(--pattern); background-size: 48px 48px;
}
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; text-decoration: none; font-weight: 600; }
.brand img { height: 30px; width: auto; }
.brand span { padding-left: 14px; border-left: 2px solid var(--brand); font-size: 14.5px; letter-spacing: .01em; color: #fff; }
.topbar form { position: relative; z-index: 1; margin: 0; }
.topbar-btn {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 8px; cursor: pointer; text-decoration: none;
  font-family: inherit; font-weight: 500; font-size: 14px; color: #fff;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18);
}
.topbar-btn:hover { background: rgba(255, 255, 255, .14); }
@media (max-width: 520px) { .topbar-btn span, .brand span { display: none; } }

.admin { max-width: 920px; margin: 0 auto; padding: 32px 20px 72px; }
.admin-wide { max-width: 1240px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-family: var(--display); font-weight: 800; letter-spacing: -.015em; font-size: 32px; line-height: 1.15; letter-spacing: -.005em; }
.page-head p { margin: 6px 0 0; }
.page-head .muted { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head .muted a { color: var(--text); font-weight: 500; }
.kicker { margin: 0 0 4px !important; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-text) !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kicker { color: var(--brand) !important; } }
.back { display: inline-flex; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.back:hover { color: var(--text); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat {
  display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.stat-ic { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; flex: none; color: var(--navy); background: color-mix(in srgb, var(--navy) 8%, transparent); }
.stat-ic.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.stat-ic.accent { color: var(--brand-lo); background: color-mix(in srgb, var(--brand) 16%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stat-ic { color: #9db4ff; background: rgba(157, 180, 255, .1); } :root:not([data-theme="light"]) .stat-ic.ok { color: var(--ok); } :root:not([data-theme="light"]) .stat-ic.accent { color: var(--brand-hi); } }
.stat small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.stat strong { font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .stats { gap: 8px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
  .stat-ic { width: 36px; height: 36px; }
  .stat strong { font-size: 22px; }
}

.search {
  display: flex; align-items: center; gap: 10px; padding: 0 16px; margin-bottom: 14px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.search:focus-within { border-color: var(--focus); box-shadow: 0 0 0 2px var(--focus); }
.search input:focus { box-shadow: none; background: transparent; outline: none; }
.search input { flex: 1; min-width: 0; height: 48px; border: 0; background: transparent; font: inherit; color: var(--text); outline: none; }

.p-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.p-row { position: relative; display: grid; grid-template-columns: auto 1fr auto auto auto; align-items: center; gap: 16px; padding: 14px 18px; transition: background .15s; }
.p-row + .p-row { border-top: 1px solid var(--border); }
.p-row:hover { background: var(--surface-2); }
.p-link { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.p-av { display: block; padding: 2px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--brand); }
.avatar-sm { width: 46px; height: 46px; font-size: 16px; border: 2px solid var(--surface); }
.p-main { min-width: 0; display: flex; flex-direction: column; }
.p-name { font-weight: 600; font-size: 15.5px; }
.p-row:hover .p-name { text-decoration: underline; text-decoration-color: var(--brand); text-underline-offset: 3px; }
.p-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-views { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.p-actions { display: flex; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.on { color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, transparent); }
.badge.off { color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }
@media (max-width: 720px) {
  .p-row { grid-template-columns: auto 1fr auto; row-gap: 10px; padding: 14px; }
  .p-views { display: none; }
  .p-actions { grid-column: 2 / -1; }
}
.empty-search { text-align: center; padding: 20px; }
.empty {
  text-align: center; padding: 56px 20px; color: var(--muted);
  background: var(--surface); border: 1.5px dashed var(--border-2); border-radius: var(--radius);
}
.empty-ic { width: 64px; height: 64px; margin: 0 auto; border-radius: 20px; display: grid; place-items: center; color: var(--brand-lo); background: color-mix(in srgb, var(--brand) 14%, transparent); }
.empty h2 { color: var(--text); margin: 16px 0 4px; font-family: var(--display); font-weight: 800; letter-spacing: -.015em; font-size: 22px; }
.empty .btn { margin-top: 20px; }

/* Form */
.alert {
  display: flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 500;
  color: var(--danger-strong); background: color-mix(in srgb, var(--danger-strong) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--danger-strong) 25%, transparent);
}
.alert.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .alert:not(.ok) { color: #fca5a5; } }

.editor { display: grid; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.panel-ic {
  width: 38px; height: 38px; border-radius: 8px; flex: none; display: grid; place-items: center;
  color: var(--brand-lo); background: color-mix(in srgb, var(--brand) 14%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .panel-ic { color: var(--brand-hi); } }
.panel-head h2 { margin: 0; font-size: 16.5px; font-weight: 650; line-height: 1.3; }
.panel-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } .panel { padding: 20px 16px; } }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field > span:first-child { font-size: 13px; font-weight: 600; color: var(--text-2); }
.req { color: var(--brand-text); font-weight: 700; }
.field em, .hint { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.field em strong { color: var(--text-2); }
.input { position: relative; display: block; }
.input.has-ic > .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input.has-ic input { padding-left: 40px; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=password], textarea, .copy-input {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 8px;
  border: 1px solid var(--control-border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 15px; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:hover, textarea:hover { border-color: var(--text-2); }
input:focus, textarea:focus, .copy-input:focus {
  outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent);
}
.input:focus-within > .ic { color: var(--brand-lo); }
textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); }

.switch { display: inline-flex; align-items: center; gap: 12px; font-size: 14.5px; font-weight: 500; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { position: relative; width: 46px; height: 26px; border-radius: 999px; background: #8b93a5; transition: background .2s; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.switch input:checked + .switch-ui { background: var(--ok); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }

.photo-pick { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.photo-prev { flex: none; padding: 3px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 2px var(--brand); }
.avatar-md { width: 92px; height: 92px; font-size: 30px; border: 3px solid var(--surface); }
.photo-tools { display: grid; gap: 8px; justify-items: start; }
@media (max-width: 480px) { .photo-pick { flex-direction: column; text-align: center; } .photo-tools { justify-items: center; } }

.link-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; margin-bottom: 10px; align-items: center; }
.link-tools { display: flex; gap: 4px; }
@media (max-width: 640px) {
  .link-row { grid-template-columns: 1fr; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; }
  .link-tools { justify-content: flex-end; }
}

.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  padding: 16px 0 4px; background: linear-gradient(transparent, var(--bg) 40%);
}
.save-note { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 500; color: var(--brand-text); }
.save-note::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .save-note { color: var(--brand-hi); } }
.save-bar .btn { min-width: 170px; min-height: 50px; }

/* Düzenleme sayfası yerleşimi */
.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.side { display: grid; gap: 18px; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; scrollbar-width: thin; padding: 2px 4px 2px 2px; margin: -2px -4px -2px -2px; }
@media (max-width: 1040px) {
  .edit-layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; overflow: visible; }
  .phone-wrap { display: none; }
}

/* Telefon önizleme */
.phone-wrap { display: grid; justify-items: center; gap: 12px; }
.phone-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.phone {
  position: relative; width: 320px; height: 650px; padding: 12px; border-radius: 50px;
  background: linear-gradient(145deg, #1b2440, #070c1a);
  box-shadow: inset 0 0 0 1.5px #39456a, inset 0 0 0 6px #0b1124, var(--shadow-lg);
}
.phone::before {
  content: ""; position: absolute; top: 22px; left: 50%; z-index: 2; width: 92px; height: 26px; transform: translateX(-50%);
  border-radius: 20px; background: #05080f;
}
.phone-screen { width: 100%; height: 100%; border-radius: 39px; overflow: hidden; background: var(--bg); }
.phone-screen iframe { width: 390px; height: 825px; border: 0; transform: scale(.759); transform-origin: 0 0; display: block; }

.qr-panel .qr-frame { max-width: 220px; margin-bottom: 12px; }
.url-line { text-align: center; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; margin: 0 0 14px; }
.btn-col { display: grid; gap: 8px; margin-top: 12px; }
.btn-col form { margin: 0; }
.copy-input { font-size: 13px; min-height: 42px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger-strong) 25%, var(--border)); }
.danger-zone .panel-ic { color: var(--danger-strong); background: color-mix(in srgb, var(--danger-strong) 10%, transparent); border-color: color-mix(in srgb, var(--danger-strong) 22%, transparent); }

/* ================================================================= ERİŞİLEBİLİRLİK VE UYUMLULUK */
/* overflow:hidden listelerde odak çerçevesi kırpılmasın */
.p-link:focus-visible, .row:focus-visible, .link:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.p-row:has(.p-link:focus-visible) { background: var(--surface-2); }

/* Koyu temada lacivert ana butonlar zeminde kaybolmasın */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) :is(.page-admin, .page-center) .btn-accent {
    background: linear-gradient(180deg, #2a4a8f, var(--navy-2)); border-color: color-mix(in srgb, var(--brand) 35%, transparent);
  }
}
:root[data-theme="dark"] :is(.page-admin, .page-center) .btn-accent { background: linear-gradient(180deg, #2a4a8f, var(--navy-2)); border-color: rgba(196, 30, 58, .35); }

/* color-mix() desteklemeyen eski tarayıcılar (eski iOS / uygulama içi tarayıcılar) */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .hero { background: linear-gradient(160deg, var(--accent) 0%, var(--navy) 100%); }
  .quick-ic, .btn-accent, .avatar-empty { background: var(--accent, var(--navy)); }
  .org { color: var(--brand-lo); background: rgba(196, 30, 58, .13); border-color: rgba(196, 30, 58, .3); }
  .tile, .panel-ic, .stat-ic, .empty-ic { background: rgba(127, 127, 127, .08); border-color: var(--border); }
  .badge.on { background: rgba(4, 120, 87, .1); }
  .alert { background: var(--surface); }
  .backdrop { background: radial-gradient(40vmax 40vmax at 100% 100%, rgba(196, 30, 58, .14), transparent 70%); }
}

/* ================================================================= HESAPLAR */
.login-alt { margin: 18px 0 0; font-size: 13.5px; color: var(--muted); }
.login-alt a { color: var(--text-2); font-weight: 600; text-decoration: none; }
.login-alt a:hover { color: var(--text); text-decoration: underline; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.topbar-actions { position: relative; z-index: 1; display: flex; gap: 8px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.p-row { grid-template-columns: auto 1fr auto auto auto auto; }
.p-user {
  display: inline-flex; align-items: center; gap: 5px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
}
.p-user.none { color: var(--muted); font-weight: 500; border-style: dashed; }
@media (max-width: 900px) { .p-user { display: none; } .p-row { grid-template-columns: auto 1fr auto auto auto; } }
@media (max-width: 720px) { .p-row { grid-template-columns: auto 1fr auto; } }

.pw-wrap input { padding-right: 92px; font-family: ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .02em; }
.pw-gen {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 5px; height: 34px; padding: 0 11px; border-radius: 9px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border-2);
}
.pw-gen:hover { border-color: var(--focus); }
.account-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.account-foot .muted { display: inline-flex; align-items: center; gap: 6px; }
.pw-form { display: grid; }
.pw-form .field { margin-bottom: 12px; }
