/* Savana One — platform kabuğu (giriş, uygulama seçimi, yönetim ekranları).
   Uygulamaların kendi stilleri ayrıdır; burası yalnızca çevreleyen katman.
   Palet iştakip'ten devralındı: uygulamalar arası geçiş kopuk hissettirmesin. */

:root {
  --brand: #12395f;
  --brand-dark: #0d2a46;
  --brand-soft: #e8eef5;
  --accent: #d98324;
  --accent-dark: #b96c15;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --border: #d8dee6;
  --text: #1c2733;
  --muted: #61728a;
  --ok: #1f7a45;
  --ok-soft: #e3f4ea;
  --warn: #a5730c;
  --warn-soft: #fdf3dd;
  --danger: #b3261e;
  --danger-soft: #fbe6e5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(18, 57, 95, .08), 0 6px 20px rgba(18, 57, 95, .07);
  --shadow-lg: 0 10px 40px rgba(13, 42, 70, .16);
  --tap: 48px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a { color: var(--brand); }

h1, h2, h3 { margin: 0 0 4px; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }

/* ==== Yükleme ekranı ==================================================== */
.splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 70%, #08192b 100%);
  color: #fff;
  text-align: center;
  padding: 24px;
}

.splash-inner { animation: rise .55s cubic-bezier(.2, .8, .3, 1) both; }

.splash .mark {
  width: 84px;
  height: 84px;
  margin: 0 auto 20px;
  border-radius: 22px;
  background: #fff;
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .3);
}

.splash h1 { font-size: 27px; font-weight: 700; letter-spacing: .3px; }
.splash p { margin: 6px 0 0; opacity: .7; font-size: 14px; }

.splash .bar {
  width: 190px;
  height: 3px;
  margin: 30px auto 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, .18);
  overflow: hidden;
}

.splash .bar i {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  animation: slide 1.05s ease-in-out infinite;
}

@keyframes slide {
  0%   { transform: translateX(-105%); }
  100% { transform: translateX(355%); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* Hareketi rahatsız edici bulan kullanıcılar için animasyonlar kapanır. */
@media (prefers-reduced-motion: reduce) {
  .splash-inner, .splash .bar i, .app-card { animation: none !important; transition: none !important; }
}

/* ==== Giriş / şifre ekranları =========================================== */
.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 460px at 50% -8%, rgba(18, 57, 95, .13), transparent 70%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 30px 26px 26px;
}

.auth-head { text-align: center; margin-bottom: 22px; }

.auth-head .mark {
  width: 60px;
  height: 60px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
}

.auth-head h1 { font-size: 21px; }
.auth-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.auth-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 14px;
}

.auth-note {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ==== Üst bar =========================================================== */
.topbar {
  background: var(--brand);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}

.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.topbar a { color: #fff; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
}

.brand .mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #fff;
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  flex: none;
}

.brand small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  opacity: .72;
  letter-spacing: .3px;
}

.topbar .spacer { flex: 1 1 auto; }

.topnav { display: flex; gap: 4px; flex-wrap: wrap; }

.topnav a {
  padding: 7px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  opacity: .85;
}

.topnav a:hover { background: rgba(255, 255, 255, .12); opacity: 1; }
.topnav a.active { background: rgba(255, 255, 255, .17); opacity: 1; font-weight: 600; }

.whoami {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.whoami b { display: block; font-weight: 600; }
.whoami span { opacity: .7; font-size: 11.5px; }

/* Superadmin başka bir şirketin içindeyken görünen uyarı şeridi. */
.acting-bar {
  background: var(--accent);
  color: #3a2405;
  font-size: 13px;
  font-weight: 600;
}

.acting-bar .topbar-inner { padding: 7px 16px; }
.acting-bar a { color: #3a2405; }

/* ==== Sayfa gövdesi ===================================================== */
.container { max-width: 1160px; margin: 0 auto; padding: 22px 16px 60px; }

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head .sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }
.page-head .grow { flex: 1 1 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -2px 0 14px;
}

.card-head .grow { flex: 1 1 auto; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* ==== Uygulama seçim ekranı ============================================= */
.app-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  min-height: 172px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  /* Kart rengi uygulamanın kendi rengidir; şablonda --c olarak verilir. */
  --c: var(--brand);
}

.app-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  border-radius: 15px 15px 0 0;
  background: var(--c);
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c);
}

.app-card .icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--c);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 800;
  flex: none;
}

.app-card h2 { font-size: 18px; }
.app-card p { margin: 0; color: var(--muted); font-size: 13.5px; flex: 1 1 auto; }

.app-card .go {
  font-size: 13px;
  font-weight: 600;
  color: var(--c);
}

/* Kullanıcının erişemediği, bilgi amaçlı gösterilen kart. */
.app-card.locked { opacity: .58; cursor: not-allowed; }
.app-card.locked:hover { transform: none; box-shadow: var(--shadow); border-color: var(--border); }

/* Henüz yayına girmemiş uygulama: yalnızca duyuru, tıklanacak yeri yok.
   Kesik kenarlık "burası hazır değil" mesajını sözcük gerekmeden verir. */
.app-card.soon {
  cursor: default;
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}
.app-card.soon:hover { transform: none; box-shadow: none; border-color: var(--border); }
.app-card.soon::before { opacity: .4; }
.app-card.soon .icon { opacity: .5; }
.app-card.soon h2, .app-card.soon p, .app-card.soon .go { opacity: .72; }

/* Uygulama kartına özel görsel konursa (şirket logosu, ekran görüntüsü). */
.app-card .shot {
  width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty .big { font-size: 34px; margin-bottom: 8px; }

/* ==== Formlar =========================================================== */
.field { margin-bottom: 14px; }

.field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=search], input[type=date], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;   /* iOS'ta 16px altı odakta sayfayı yakınlaştırır */
}

textarea { min-height: 84px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 57, 95, .13);
}

input:disabled, select:disabled { background: #f4f6f8; color: var(--muted); }

.hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

.grid {
  display: grid;
  gap: 0 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.inline { display: inline; }

/* ==== Düğmeler ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap);
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}

.btn:hover { background: #f7f9fb; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #edc9c6; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: #eef1f5; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==== Bildirim şeritleri ================================================ */
.flash {
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14.5px;
  border: 1px solid transparent;
}

.flash.ok   { background: var(--ok-soft);     border-color: #bfe3cd; color: #14562f; }
.flash.bad  { background: var(--danger-soft); border-color: #f0c9c6; color: #8c1d16; }
.flash.warn { background: var(--warn-soft);   border-color: #eddaa6; color: #7d5708; }
.flash.info { background: var(--brand-soft);  border-color: #c9d8e8; color: #16456f; }

/* ==== Tablolar ========================================================== */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; padding: 0 18px 18px; }

table { width: 100%; border-collapse: collapse; font-size: 14.5px; }

th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }

.subtle { color: var(--muted); font-size: 13px; }

/* ==== Rozetler ========================================================== */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand);
  white-space: nowrap;
}

.badge.ok     { background: var(--ok-soft);     color: var(--ok); }
.badge.warn   { background: var(--warn-soft);   color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.muted  { background: #eef1f5;            color: var(--muted); }
.badge.accent { background: #fdf0dd;            color: var(--accent-dark); }

/* ==== Yetki ekranı: uygulama satırları ================================== */
.perm-list { display: grid; gap: 10px; }

.perm {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fcfdfe;
  --c: var(--brand);
}

.perm.on { border-color: var(--c); background: #fff; }
.perm.off .perm-role { opacity: .45; pointer-events: none; }

.perm .icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--c);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  flex: none;
}

.perm .grow { flex: 1 1 auto; min-width: 0; }
.perm b { display: block; font-size: 15px; }
.perm .sub { font-size: 12.5px; color: var(--muted); }
.perm-role { width: 210px; flex: none; }
.perm-role select { min-height: 40px; font-size: 14px; }

/* Anahtar (aç/kapa) */
.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }

.switch i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cfd7e0;
  transition: background .16s ease;
}

.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .16s ease;
}

.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(19px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(18, 57, 95, .2); }

/* Henüz açılamayan uygulamanın anahtarı: çevrilemediği görünsün. */
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + i { background: #e3e8ee; }
.switch input:disabled ~ * { pointer-events: none; }
.perm:has(.switch input:disabled) .icon { opacity: .5; }
.perm:has(.switch input:disabled) b,
.perm:has(.switch input:disabled) .sub { opacity: .72; }

/* ==== Küçük ekran ======================================================= */
@media screen and (max-width: 640px) {
  .topbar-inner { gap: 10px; }
  .whoami span { display: none; }
  .perm { flex-wrap: wrap; }
  .perm-role { width: 100%; }
  .page-head { align-items: flex-start; }
}
