/* Webfolio — clean, minimal directory
   One accent, generous space, restrained motion. */

:root {
  --bg:        #0c0d10;
  --surface:   #141519;
  --surface-2: #1b1c21;
  --border:    #26272e;
  --border-2:  #34353d;
  --text:      #f4f4f6;
  --muted:     #9a9ca5;
  --faint:     #63656e;
  --accent:    #6c8cff;
  --accent-2:  #5a7bf0;
  --danger:    #f06c7d;
  --ok:        #54c69a;
  --radius:    14px;
  --maxw:      1140px;
  --font:      "Plus Jakarta Sans", system-ui, sans-serif;
  --mono:      "JetBrains Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
header.top {
  border-bottom: 1px solid var(--border);
  background: rgba(12, 13, 16, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.top-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.logo .mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.95rem;
}
.logo span { color: var(--accent); }
.top-meta { color: var(--faint); font-size: 0.85rem; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 36px; }
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  max-width: 16ch;
}
.hero p {
  color: var(--muted);
  font-size: 1.05rem;
  margin-top: 14px;
  max-width: 52ch;
}

/* ---------- Search + filters ---------- */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 32px;
}
.search {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.search svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  stroke: var(--faint);
}
.search input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
}
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--accent); }

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.pill {
  height: 34px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.pill:hover { color: var(--text); border-color: var(--border-2); }
.pill.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.count {
  color: var(--faint);
  font-size: 0.88rem;
  margin: 30px 0 16px;
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding-bottom: 60px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s, transform 0.18s;
}
.card:hover { border-color: var(--border-2); transform: translateY(-3px); }
.card .shot {
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  object-fit: cover;
  width: 100%;
  border-bottom: 1px solid var(--border);
}
.card .body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card .head { display: flex; align-items: center; gap: 10px; }
.card .head img { width: 20px; height: 20px; border-radius: 5px; flex: none; }
.card .head h3 { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.card .desc {
  color: var(--muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.card .cat {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.card .foot {
  margin-top: auto;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card .stats { color: var(--faint); font-size: 0.8rem; }
.card a.open {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: var(--surface); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Empty ---------- */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--faint);
}
.empty b { display: block; color: var(--muted); font-size: 1.05rem; margin-bottom: 4px; }

/* ---------- Site detail ---------- */
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  margin: 36px 0 24px;
}
.back:hover { color: var(--text); }
.back svg { width: 16px; height: 16px; }

.detail {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 36px;
  padding-bottom: 80px;
  align-items: start;
}
.preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.preview .bar {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.preview .dots { display: flex; gap: 6px; }
.preview .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-2); display: block; }
.preview .addr {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview img { width: 100%; aspect-ratio: 16/10; object-fit: cover; object-position: top; }
.preview iframe { width: 100%; height: 540px; border: 0; background: #fff; }

.side h1 {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}
.side h1 img { width: 34px; height: 34px; border-radius: 8px; }
.side .host {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin: 8px 0 20px;
  display: inline-block;
}
.side .about { color: var(--muted); margin-bottom: 22px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.metrics {
  display: flex;
  gap: 28px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.metrics div b { display: block; font-size: 1.4rem; font-weight: 800; }
.metrics div span { color: var(--faint); font-size: 0.8rem; }

/* ---------- Admin ---------- */
.center {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
}
.login .mark {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff; font-weight: 800;
  margin-bottom: 20px;
}
.login h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.login p { color: var(--muted); font-size: 0.9rem; margin: 6px 0 24px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 7px;
}
.field label small { color: var(--faint); font-weight: 500; }
.inp {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  transition: border-color 0.15s;
}
textarea.inp { height: auto; padding: 12px 14px; min-height: 84px; resize: vertical; }
.inp:focus { border-color: var(--accent); }
.err { color: var(--danger); font-size: 0.84rem; margin-top: 4px; min-height: 1.2em; }
.note {
  margin-top: 18px;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 0.82rem;
  color: var(--muted);
}
.note code { font-family: var(--mono); color: var(--accent); }

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 36px 0 28px;
}
.admin-top h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.02em; }
.admin-top p { color: var(--muted); font-size: 0.9rem; }
.admin-actions { display: flex; gap: 10px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.kpi b { font-size: 1.7rem; font-weight: 800; display: block; }
.kpi span { color: var(--faint); font-size: 0.84rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 60px;
}
.panel .ph {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.tscroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  font-weight: 700;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
td { padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.tsite { display: flex; align-items: center; gap: 11px; }
.tsite img { width: 34px; height: 24px; border-radius: 5px; object-fit: cover; background: var(--surface-2); flex: none; }
.tsite b { font-weight: 700; }
.tsite small { display: block; color: var(--faint); font-family: var(--mono); font-size: 0.74rem; }
.row-act { display: flex; gap: 8px; }
.iconbtn {
  width: 32px; height: 32px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  display: grid; place-items: center;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
}
.iconbtn:hover { color: var(--text); border-color: var(--border-2); }
.iconbtn.del:hover { color: var(--danger); border-color: var(--danger); }
.iconbtn svg { width: 15px; height: 15px; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.6);
  display: none;
  place-items: center;
  padding: 24px;
}
.overlay.open { display: grid; }
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
}
.modal .mh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.modal .mh h3 { font-size: 1.2rem; font-weight: 800; }
.modal .mb { padding: 22px; }
.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.switch .track {
  width: 42px; height: 24px;
  border-radius: 99px;
  background: var(--border-2);
  position: relative;
  flex: none;
  transition: background 0.18s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
}
.switch.on .track { background: var(--accent); }
.switch.on .track::after { transform: translateX(18px); }
.switch small { color: var(--faint); }
.form-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

footer.bot {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--faint);
  font-size: 0.85rem;
}

@media (max-width: 820px) {
  .detail { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 44px 0 28px; }
  .grid { grid-template-columns: 1fr; }
  .admin-top { flex-direction: column; align-items: flex-start; }
}

/* ============ Embedded site viewer ============ */
.embed-body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* #app wraps the bar + stage — it must fill the body and stay a
   flex column so the stage (flex:1) can grow to full height. */
.embed-body #app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.embed-bar {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.eb-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
  flex: none;
}
.eb-back:hover { color: var(--text); border-color: var(--border-2); }
.eb-back svg { width: 16px; height: 16px; }
.eb-site {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.eb-site img { width: 22px; height: 22px; border-radius: 5px; flex: none; }
.eb-text { min-width: 0; line-height: 1.25; }
.eb-text b { font-size: 0.95rem; font-weight: 700; display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-text small { color: var(--faint); font-family: var(--mono); font-size: 0.75rem; }
.eb-actions { display: flex; gap: 8px; flex: none; }
.eb-btn {
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.eb-btn:hover { color: var(--accent); border-color: var(--border-2); }
.eb-btn svg { width: 16px; height: 16px; }

.embed-stage { position: relative; flex: 1; min-height: 0; background: #fff; }
#frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }

.embed-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  color: var(--muted);
}
.embed-loading p { font-weight: 600; font-size: 0.95rem; }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.embed-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.embed-fallback[hidden] { display: none; }
.fb-card {
  text-align: center;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 38px 32px;
}
.fb-icon {
  width: 54px; height: 54px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--accent);
}
.fb-icon svg { width: 26px; height: 26px; }
.fb-card h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.fb-card p { color: var(--muted); font-size: 0.92rem; margin: 10px 0 22px; }
.fb-card .btn { justify-content: center; }
.fb-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--faint);
  font-size: 0.86rem;
  font-weight: 600;
}
.fb-link:hover { color: var(--muted); }

@media (max-width: 560px) {
  .eb-back span { display: none; }
  .eb-back { padding: 0 11px; }
}

/* ===== preview badges (card + table) ===== */
.card { position: relative; }
.card-badge {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 2;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 99px;
  backdrop-filter: blur(4px);
}
.b-live  { background: rgba(84,198,154,0.18); color: #54c69a; border: 1px solid rgba(84,198,154,0.4); }
.b-thumb { background: rgba(108,140,255,0.18); color: #93a7ff; border: 1px solid rgba(108,140,255,0.4); }
.pill.b-live, .pill.b-thumb { font-size: 0.72rem; }

/* ===== segmented control ===== */
.seg {
  display: flex;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px;
}
.seg button {
  flex: 1;
  height: 36px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: #fff; }
.hint { font-size: 0.8rem; color: var(--faint); margin-top: 7px; }

/* ===== thumbnail picker ===== */
.thumb-pick { display: flex; gap: 14px; align-items: flex-start; }
.thumb-prev {
  width: 116px; height: 74px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg) center / cover no-repeat;
  flex: none;
}

/* ===== thumbnail viewer (preview mode page) ===== */
.thumb-stage {
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow-y: auto;
}
.thumb-view {
  width: 100%;
  max-width: 860px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.thumb-shot { background: var(--surface-2); }
.thumb-shot img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
}
.thumb-shot img.noimg { visibility: hidden; }
.thumb-info { padding: 26px 28px 30px; }
.thumb-info h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.thumb-info p { color: var(--muted); margin: 10px 0 22px; }
.thumb-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.thumb-actions .btn svg { width: 16px; height: 16px; }

@media (max-width: 560px) {
  .thumb-pick { flex-direction: column; }
  .thumb-prev { width: 100%; height: 120px; }
  .thumb-actions .btn { flex: 1; justify-content: center; }
}

/* ===== admin mode banner ===== */
.modebar {
  margin: 0 0 22px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.5;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}
.modebar:empty { display: none; }
.modebar b { color: var(--text); }
.modebar code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
}
.modebar.ok   { border-color: rgba(84,198,154,0.4);  background: rgba(84,198,154,0.08); }
.modebar.ok b { color: #54c69a; }
.modebar.warn { border-color: rgba(255,203,107,0.4); background: rgba(255,203,107,0.08); }
.modebar.warn b { color: #ffcb6b; }
