/* ============================================================
 *  styles.css  -  Kasa arayuzu
 * ============================================================ */
:root {
  --rail: #12161f;
  --rail-2: #1a1f2b;
  --rail-text: #aab2c0;
  --rail-text-dim: #6b7484;
  --accent: #6366f1;
  --accent-strong: #4f46e5;
  --accent-soft: #eef0fe;

  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #14171d;
  --muted: #646b78;
  --line: #e5e8ee;
  --line-strong: #d4d9e2;

  --ok: #16a34a; --ok-soft:#dcfce7;
  --warn: #d97706; --warn-soft:#fef3c7;
  --bad: #dc2626; --bad-soft:#fee2e2;

  --shadow: 0 1px 2px rgba(16,22,40,.06), 0 8px 24px rgba(16,22,40,.06);
  --shadow-lg: 0 10px 40px rgba(16,22,40,.18);
  --radius: 12px;
  --mono: "SF Mono","Cascadia Code","JetBrains Mono","Roboto Mono",ui-monospace,Menlo,Consolas,monospace;
  --sans: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Inter,system-ui,"Helvetica Neue",Arial,sans-serif;
}
[data-theme="dark"] {
  --bg: #0e1116; --surface: #161a21; --surface-2: #1b202a;
  --ink: #e7eaef; --muted: #9aa3b1; --line: #262c37; --line-strong:#333a47;
  --accent-soft: #1d2030;
  --ok-soft:#0e2a1a; --warn-soft:#2a2310; --bad-soft:#2a1414;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.55);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg);
  font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }

/* ---------- AUTH ---------- */
.auth-wrap {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(99,102,241,.16), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 408px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-lg); padding: 34px 32px 28px; position: relative;
}
.brand-lock {
  width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(155deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 8px 20px rgba(79,70,229,.35);
}
.brand-lock svg { width: 28px; height: 28px; }
.auth-title { text-align: center; font-size: 21px; font-weight: 680; letter-spacing: -.01em; margin: 0 0 4px; }
.auth-sub { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 13.5px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 14px;
  background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); transition: .15s;
}
.btn:hover { background: var(--line); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-danger:hover { filter: brightness(.94); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: 9px; background: transparent; border-color: transparent; color: var(--muted); }
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.btn svg, .btn-icon svg { width: 16px; height: 16px; flex: none; }
.auth-foot { text-align: center; margin-top: 16px; font-size: 13px; color: var(--muted); }
.auth-foot a { font-weight: 600; cursor: pointer; }
.auth-error {
  background: var(--bad-soft); color: var(--bad); border: 1px solid transparent;
  padding: 9px 12px; border-radius: 9px; font-size: 13px; margin-bottom: 14px;
}
.auth-note { background: var(--surface-2); border:1px solid var(--line); padding: 10px 12px; border-radius: 9px; font-size: 12.5px; color: var(--muted); margin-bottom: 16px; }

/* ---------- APP SHELL ---------- */
.app { display: grid; grid-template-columns: 240px 340px 1fr; height: 100vh; height: 100dvh; }
.rail { background: var(--rail); color: var(--rail-text); display: flex; flex-direction: column; min-height: 0; }
.rail-head { padding: 18px 16px 14px; display: flex; align-items: center; gap: 10px; }
.rail-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(155deg,var(--accent),var(--accent-strong)); display: grid; place-items: center; color:#fff; flex: none; }
.rail-mark svg { width: 17px; height: 17px; }
.rail-name { font-weight: 680; color: #fff; font-size: 15px; letter-spacing:-.01em; }
.rail-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 10px; min-height: 0; }
.rail-section { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--rail-text-dim); margin: 16px 8px 6px; display:flex; justify-content:space-between; align-items:center; }
.rail-section button { color: var(--rail-text-dim); }
.rail-section button:hover { color:#fff; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 9px; color: var(--rail-text); background: transparent; border: none;
  font-size: 13.5px; font-weight: 500; transition: .12s;
}
.nav-item:hover { background: var(--rail-2); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity:.9; }
.nav-item .count { margin-left: auto; font-size: 11.5px; color: var(--rail-text-dim); background: rgba(255,255,255,.06); padding: 1px 7px; border-radius: 20px; }
.nav-item.active .count { color:#fff; background: rgba(255,255,255,.2); }
.vault-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.rail-foot { border-top: 1px solid rgba(255,255,255,.07); padding: 10px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.rail-foot .who { min-width: 0; flex: 1; }
.rail-foot .who b { color: #fff; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-foot .who span { font-size: 11px; color: var(--rail-text-dim); }

/* ---------- LIST COLUMN ---------- */
.list-col { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.list-title { font-weight: 680; font-size: 16px; margin: 0 0 10px; display:flex; align-items:center; gap:8px; letter-spacing:-.01em;}
.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search-box input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface-2); color: var(--ink); }
.search-box input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.list-tools { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.list-tools select { flex: 1; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); color: var(--ink); font-size: 12.5px; }
.list-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.item-row { display: flex; align-items: center; gap: 11px; padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s; }
.item-row:hover { background: var(--surface-2); }
.item-row.active { background: var(--accent-soft); }
.item-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; flex: none; }
.item-main { min-width: 0; flex: 1; }
.item-main .t { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-main .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row .star { color: var(--warn); flex: none; opacity: 0; }
.item-row .star.on { opacity: 1; }
.item-row:hover .star { opacity: .5; }
.item-row .star.on { opacity: 1; }
.empty-state { padding: 60px 24px; text-align: center; color: var(--muted); }
.empty-state svg { width: 40px; height: 40px; opacity: .4; margin-bottom: 12px; }

/* ---------- DETAIL COLUMN ---------- */
.detail-col { background: var(--bg); overflow-y: auto; min-height: 0; }
.detail-pad { max-width: 640px; margin: 0 auto; padding: 22px 26px 60px; }
.detail-top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 22px; }
.detail-ico { width: 50px; height: 50px; border-radius: 13px; display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #fff; flex: none; }
.detail-h { flex: 1; min-width: 0; }
.detail-h h1 { font-size: 20px; margin: 2px 0 2px; font-weight: 680; letter-spacing: -.01em; word-break: break-word; }
.detail-h .vlabel { font-size: 12.5px; color: var(--muted); display:inline-flex; align-items:center; gap:6px; }
.detail-actions { display: flex; gap: 6px; }
.field-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.frow { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.frow:last-child { border-bottom: none; }
.frow .fl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); width: 84px; flex: none; }
.frow .fv { flex: 1; min-width: 0; word-break: break-word; font-size: 14px; }
.frow .fv.mono { font-family: var(--mono); font-size: 13.5px; }
.frow .fv a { word-break: break-all; }
.frow .facts { display: flex; gap: 2px; flex: none; }
.reveal-dots { letter-spacing: 2px; }
.totp-wrap { display: flex; align-items: center; gap: 10px; }
.totp-code { font-family: var(--mono); font-size: 18px; font-weight: 600; letter-spacing: 2px; color: var(--accent-strong); }
.totp-ring { width: 22px; height: 22px; flex: none; }
.notes-box { white-space: pre-wrap; font-size: 13.5px; color: var(--ink); }
.meta-line { font-size: 12px; color: var(--muted); margin-top: 4px; padding: 0 2px; }
.detail-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 24px; }
.detail-empty svg { width: 54px; height: 54px; opacity: .3; margin-bottom: 14px; }

/* strength meter */
.strength { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.strength-bar { flex: 1; height: 6px; border-radius: 4px; background: var(--line); overflow: hidden; }
.strength-bar i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .25s, background .25s; }
.strength-1 i { width: 25%; background: var(--bad); }
.strength-2 i { width: 50%; background: var(--warn); }
.strength-3 i { width: 75%; background: #2563eb; }
.strength-4 i { width: 100%; background: var(--ok); }
.strength-label { font-size: 12px; font-weight: 600; width: 78px; text-align: right; }
.strength-1 .strength-label { color: var(--bad); }
.strength-2 .strength-label { color: var(--warn); }
.strength-3 .strength-label { color: #2563eb; }
.strength-4 .strength-label { color: var(--ok); }

/* ---------- EDITOR ---------- */
.editor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.editor h2 { font-size: 16px; margin: 0 0 16px; }
.editor .field label { font-size: 12px; }
.type-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.type-tab { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.type-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); }
.cf-row { display: flex; gap: 8px; margin-bottom: 8px; }
.cf-row .input { flex: 1; }
.editor-foot { display: flex; gap: 10px; margin-top: 18px; }
.editor-foot .btn-primary { flex: 1; }

/* generator popover */
.gen-pop { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 14px; width: 320px; }
.gen-out { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 12px; }
.gen-out .v { flex: 1; font-family: var(--mono); font-size: 13.5px; word-break: break-all; }
.gen-opt { display: flex; align-items: center; justify-content: space-between; font-size: 13px; padding: 5px 0; }
.gen-opt input[type=range] { width: 130px; }
.switch { position: relative; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: var(--line-strong); border-radius: 20px; transition: .2s; }
.switch .sl:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .sl { background: var(--accent); }
.switch input:checked + .sl:before { transform: translateX(16px); }

/* ---------- MODAL ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(12,16,28,.5); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 86vh; display: flex; flex-direction: column; }
.modal.wide { max-width: 680px; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 680; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-admin { background: var(--accent-soft); color: var(--accent-strong); }
.badge-member { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-off { background: var(--bad-soft); color: var(--bad); }
.member-chk { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.member-chk:last-child { border-bottom: none; }
.member-chk .who { flex: 1; min-width: 0; }
.member-chk .who b { font-size: 13.5px; display:block; }
.member-chk .who span { font-size: 12px; color: var(--muted); }

/* security dashboard */
.sec-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 12px; margin-bottom: 20px; }
.sec-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.sec-card .n { font-size: 30px; font-weight: 720; letter-spacing: -.02em; }
.sec-card .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.sec-card.bad .n { color: var(--bad); } .sec-card.warn .n { color: var(--warn); } .sec-card.ok .n { color: var(--ok); }
.sec-section h3 { font-size: 14px; margin: 18px 0 8px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px; font-size: 12px; color: var(--muted); }

/* toast */
.toast-wrap { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--rail); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px; animation: toastin .2s ease; }
.toast svg { width: 16px; height: 16px; }
.toast.ok svg { color: #4ade80; } .toast.err svg { color: #f87171; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* lock overlay */
.lock-screen { position: fixed; inset: 0; z-index: 80; background: rgba(8,11,16,.55); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 20px; }

/* misc */
.row-between { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.muted { color: var(--muted); }
.mt8{margin-top:8px} .mt16{margin-top:16px} .mb8{margin-bottom:8px} .mb16{margin-bottom:16px}
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.warn-box { background: var(--warn-soft); color: var(--warn); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 12px; }
.mobile-only { display: none; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) { .app { grid-template-columns: 220px 300px 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: none; box-shadow: var(--shadow-lg); }
  .list-col { display: flex; }
  .detail-col { display: none; position: fixed; inset: 0; z-index: 40; }
  .app.show-detail .detail-col { display: block; }
  .app.show-detail .list-col { display: none; }
  .mobile-only { display: inline-flex; }
  .rail-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
