:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 14px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { font-size: 28px; }
.brand h1 { font-size: 19px; margin: 0; letter-spacing: -0.2px; }
.brand-count { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- Tombol ---------- */
.btn-icon {
  border: none;
  background: transparent;
  color: var(--muted);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--accent-soft); color: var(--accent); }
.btn-icon svg { width: 20px; height: 20px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg); color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-block { width: 100%; margin-top: 16px; }

/* ---------- Grid kartu ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.card-body { padding: 16px 16px 4px; flex: 1; min-width: 0; }
.card-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
}
.card-content {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-height: 320px;
  overflow-y: auto;
}
.card-footer { padding: 12px 16px; border-top: 1px solid var(--line); }
.btn-copy {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #dde3fb;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-copy:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-copy.copied { background: #ecfdf5; color: var(--ok); border-color: #bbf7d0; }
.btn-copy svg { width: 16px; height: 16px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
  font-size: 15px;
}
.empty-icon { font-size: 44px; margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .3);
  z-index: 100;
  transition: opacity .25s, transform .25s;
}
.toast.hidden { opacity: 0; transform: translateX(-50%) translateY(10px); pointer-events: none; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  z-index: 50;
  overflow-y: auto;
}
.modal {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  padding: 22px 24px 26px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-header h2 { margin: 0; font-size: 18px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
  color: var(--ink);
}
input[type="text"], input[type="password"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
textarea { resize: vertical; min-height: 90px; }

.login-row { display: flex; gap: 8px; margin-top: 2px; }
.login-row input { flex: 1; }

.form-actions { display: flex; gap: 8px; margin-top: 14px; }

.section-title {
  font-size: 14px;
  margin: 22px 0 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.admin-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafbfc;
}
.admin-item-text { flex: 1; min-width: 0; }
.admin-item-title { font-weight: 600; font-size: 13.5px; }
.admin-item-snippet {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-item-actions { display: flex; gap: 6px; }
.admin-item-actions .btn-icon { width: 32px; height: 32px; }
.admin-item-actions .btn-icon svg { width: 16px; height: 16px; }
.btn-icon.edit:hover { color: var(--accent); background: var(--accent-soft); }
.btn-icon.delete:hover { color: var(--danger); background: #fef2f2; }

.error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.hidden { display: none !important; }
