/* Kasa — tam sayfa kasa.
   Aynı sayfa hem masaüstü eklentisinde hem telefondaki PWA'da çalışır:
   geniş ekranda üç sütun, dar ekranda tek sütun + alt gezinme. */

body {
  height: 100vh;
  overflow: hidden;
}
#app { height: 100%; }

.boot { display: grid; place-items: center; height: 100vh; }

/* ============================================================ kabuk ===== */

.shell {
  display: grid;
  grid-template-columns: 236px 340px 1fr;
  height: 100%;
}
.shell.is-wide { grid-template-columns: 236px 1fr; }
.shell.is-single { grid-template-columns: 1fr; }

/* ---------------------------------------------------------- kenar çubuğu */

.side {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 8px 14px;
}
.side-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  box-shadow: var(--sh-accent);
}
.side-mark svg { width: 18px; height: 18px; }
.side-title { font-size: 16px; font-weight: 680; letter-spacing: -0.022em; }
.side-sub { font-size: 11px; color: var(--text-3); }

.side-group { margin-top: 14px; }
.side-group .section-title { padding: 0 8px 6px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.side-link svg { width: 17px; height: 17px; flex: none; }
.side-link:hover { background: var(--surface-hover); color: var(--text); }
.side-link.is-on { background: var(--accent-soft); color: var(--accent-text); font-weight: 620; }
.side-link .count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
}
.side-link.is-on .count { color: var(--accent-text); }

.side-foot { margin-top: auto; padding-top: 14px; }

/* ------------------------------------------------------------- liste --- */

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;   /* ızgara hücresi içeriğe göre büyümesin, panel kendi kaysın */
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.pane:last-child { border-right: 0; }

.pane-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  min-height: 57px;
}
.pane-head h2 { flex: 1; min-width: 0; }

.pane-body { flex: 1; overflow-y: auto; }
.pane-body.pad { padding: 20px 22px 32px; }

.list { padding: 8px; }

/* ---------------------------------------------------------- ayrıntı ---- */

.detail-wrap { max-width: 720px; }

.hero {
  display: flex;
  align-items: center;
  gap: 15px;
  padding-bottom: 20px;
}
.hero h1 { font-size: 22px; }
.hero-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; }

.kv {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 10px 11px 14px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--border);
}
.kv + .kv { margin-top: 7px; }
.kv-body { flex: 1; min-width: 0; }
.kv-label {
  font-size: 10.5px;
  font-weight: 620;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}
.kv-value { font-size: 14px; color: var(--text); word-break: break-word; }
.kv-value.secret { font-family: var(--mono); letter-spacing: 0.04em; }
.kv-actions { display: flex; gap: 1px; flex: none; }

.totp { display: flex; align-items: center; gap: 10px; }
.totp-code {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 620;
  letter-spacing: 0.12em;
  color: var(--accent-text);
}
.totp-ring {
  --p: 100;
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--border-strong) 0);
  mask: radial-gradient(circle, transparent 54%, #000 56%);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 56%);
}

/* ------------------------------------------------------------- düzen --- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.form-section {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}
.form-section:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }

.uri-row { display: flex; gap: 8px; align-items: center; }
.uri-row .select { width: 132px; flex: none; }

/* ---------------------------------------------------------- güvenlik --- */

.health {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px;
  border-radius: var(--r-xl);
  background: var(--grad-soft);
  border: 1px solid var(--border);
}
.health-ring {
  --p: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--health-color, var(--accent)) calc(var(--p) * 1%), var(--border-strong) 0);
}
.health-ring::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--bg);
}
.health-num {
  /* ::after halkanın ortasını kapatan disktir ve son çocuk gibi boyanır;
     z-index vermezsek sayının üstünü örter. */
  position: relative;
  z-index: 1;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--health-color, var(--accent));
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.stat {
  padding: 15px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stat-num { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.stat-icon { display: inline-flex; margin-bottom: 8px; }
.stat-icon svg { width: 19px; height: 19px; }

/* ---------------------------------------------------------- ayarlar ---- */

.set-group {
  padding: 4px 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}
.set-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
}
.set-row + .set-row { border-top: 1px solid var(--border); }
.set-row .grow { min-width: 0; }
.set-name { font-size: 13.5px; font-weight: 560; }
.set-desc { font-size: 12px; color: var(--text-3); line-height: 1.45; margin-top: 1px; }
.set-row .select,
.set-row .input { width: auto; min-width: 150px; flex: none; }

/* ----------------------------------------------------------- üreteç ---- */

.gen { padding: 0; }
.gen-out {
  padding: 18px 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
}
.gen-text {
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 520;
  word-break: break-all;
  min-height: 52px;
  user-select: all;
}
.gen-text .d { color: var(--info); }
.gen-text .s { color: var(--warn); }
.gen-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 2px; }
.gen-row .label { flex: 1; }

/* -------------------------------------------------------- karşılama ---- */

.welcome {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 20px;
  background: radial-gradient(1100px 520px at 50% -10%, var(--bg-tint), var(--bg));
}
.welcome-card {
  width: min(100%, 470px);
  padding: 32px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-lg);
}
.welcome-mark {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 19px;
  background: var(--grad);
  color: #fff;
  box-shadow: var(--sh-accent);
  margin-bottom: 18px;
}
.welcome-mark svg { width: 29px; height: 29px; }

.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.step-dot {
  flex: 1;
  height: 3px;
  border-radius: var(--r-full);
  background: var(--border-strong);
  transition: background var(--normal) var(--ease);
}
.step-dot.is-on { background: var(--accent); }

.note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 12.5px;
  line-height: 1.5;
}
.note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.note-warn { background: var(--warn-soft); color: var(--warn); }
.note-info { background: var(--info-soft); color: var(--info); }
.note-danger { background: var(--danger-soft); color: var(--danger); }

/* --------------------------------------------------------- kilit ------- */

.lock-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 30px 20px;
  background: radial-gradient(1100px 520px at 50% -10%, var(--bg-tint), var(--bg));
}
.lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(100%, 370px);
  padding: 34px 30px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-lg);
  text-align: center;
}
.lock-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 20px;
  background: var(--grad);
  color: #fff;
  box-shadow: var(--sh-accent);
}
.lock-mark svg { width: 30px; height: 30px; }
.lock .field, .lock .btn { width: 100%; }
.lock .input { text-align: center; font-size: 15px; height: 44px; }

/* ------------------------------------------------------ mobil gezinme -- */

.mobile-nav { display: none; }
.back-btn { display: none; }

@media (max-width: 900px) {
  /* Dar ekranda tek sütun. Kenar çubuğu akıştan çıkıp üste biner; kalan iki
     panelden yalnızca biri görünür — hangisi olduğuna `has-detail` karar verir.
     İkisini birden akışta bırakmak sayfayı iki ekran boyu uzatır.

     `.shell.is-wide` ve `.shell.is-single` de burada sayılmak ZORUNDA: onlar
     iki sınıflı seçiciler olduğu için yalnız `.shell` yazmak özgüllükte
     yenilir ve masaüstünün 236px'lik kenar sütunu telefonda da ayrılır —
     içerik ekranın yarısına sıkışır. */
  .shell,
  .shell.is-wide,
  .shell.is-single {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 262px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform var(--normal) var(--ease-out);
    box-shadow: var(--sh-lg);
    padding-bottom: 76px;
  }
  .side.is-open { transform: none; }
  .side-scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(10, 9, 15, 0.5);
    backdrop-filter: blur(2px);
  }

  .pane { border-right: 0; }

  /* Liste görünümünde: seçim yoksa liste, seçim varsa ayrıntı. */
  .shell:not(.is-wide):not(.has-detail) .pane:not(.is-list) { display: none; }
  .shell.has-detail .pane.is-list { display: none; }
  .shell.has-detail .pane:not(.is-list) { animation: slide-up 220ms var(--ease-out); }

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

  .back-btn { display: inline-flex; }

  .mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: flex;
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: var(--surface);
  }
  .nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 4px;
    border: 0;
    border-radius: var(--r);
    background: transparent;
    color: var(--text-3);
    font: inherit;
    font-size: 10.5px;
    font-weight: 580;
    cursor: pointer;
  }
  .nav-btn svg { width: 19px; height: 19px; }
  .nav-btn.is-on { color: var(--accent); background: var(--accent-soft); }

  /* Alt gezinme çubuğu içeriğin üstüne biniyor; altta yer bırak. */
  .pane-body { padding-bottom: 76px; }
  .pane-body.pad { padding: 18px 16px 84px; }
  .list { padding-bottom: 76px; }

  .health { flex-direction: column; text-align: center; gap: 16px; }
  .detail-wrap { max-width: none; }

  /* Ayar satırı: açıklama metni ile denetim yan yana sığmıyor. Yan yana
     zorlamak metni kelime kelime sarmalayıp denetimin altına itiyor. */
  .set-row {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
  }
  .set-row .select,
  .set-row .input { width: 100%; min-width: 0; }
  .set-row .btn { align-self: flex-start; }
  .set-row .switch { align-self: flex-start; }
}

/* Dokunmatikte satır eylemleri hep görünür — üzerine gelme diye bir şey yok */
@media (hover: none) {
  .row-actions { opacity: 1; }
}
