@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg-base: #010101;
    --bg-card: #141414;
    --bg-input: #1a1a1a;
    --bg-hover: #1f1f1f;
    --border: rgba(255,255,255,0.08);
    --border-strong: rgba(255,255,255,0.15);
    --text-primary: #f1f1f1;
    --text-secondary: #9ca3af;
    --text-tertiary: #71717a;
    --accent: #ff4d8d;
    --accent-2: #b0a3ff;
    --brand: #ffffff;
    --success: #4ade80;
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button {
    background:none; border:none; cursor:pointer; color:inherit; font:inherit;
    display:inline-flex; align-items:center; justify-content:center;
}
textarea, input { font:inherit; }
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.1); border-radius:3px; }

/* ============ APP LAYOUT ============ */
.app { display:flex; height:100vh; width:100%; overflow:hidden; }

/* ============ SIDEBAR ============ */
.sidebar {
    width:240px; flex-shrink:0; background:var(--bg-base);
    display:flex; flex-direction:column;
    border-right:1px solid var(--border); overflow:hidden;
}
.sidebar-header { padding:16px; display:flex; align-items:center; gap:12px; }
.logo {
    width:32px; height:32px; border-radius:50%; overflow:hidden; flex-shrink:0;
    background:linear-gradient(135deg, #ff4d8d, #b0a3ff);
    display:flex; align-items:center; justify-content:center;
}
.logo img { width:100%; height:100%; object-fit:cover; }
.logo-text { font-size:20px; font-weight:700; white-space:nowrap; }
.nav { padding:8px 16px 16px; flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:4px; }
.nav-item {
    display:flex; align-items:center; gap:12px; padding:10px 12px;
    border-radius:9999px; color:var(--text-primary); font-size:14px; font-weight:500;
    transition:background 0.2s; white-space:nowrap; overflow:hidden;
}
.nav-item:hover, .nav-item.active { background:var(--bg-hover); }
.nav-icon {
    width:18px; height:18px; flex-shrink:0;
    display:flex; align-items:center; justify-content:center; color:#F1F1F1;
}
.nav-icon svg { width:18px; height:18px; stroke-width:2; }
.nav-label { flex:1; }
.plan-badge {
    font-size:10px; padding:2px 8px; border-radius:9999px;
    font-weight:700; text-transform:uppercase; letter-spacing:0.5px;
}
.plan-badge.basic { background:rgba(156,163,175,0.15); color:#9ca3af; }
.plan-badge.plus { background:rgba(176,163,255,0.15); color:#b0a3ff; }
.plan-badge.ultra { background:rgba(255,234,140,0.15); color:#FFEA8C; }
.nav-item.admin-nav { color: #ff8fb1; }
.nav-item.admin-nav.active { background: rgba(255,77,141,0.15); }
.admin-dot {
    width: 6px; height: 6px; border-radius: 50%; background: #ff4d8d;
    flex-shrink: 0; animation: pulseDot 2s infinite;
}
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.admin-tag {
    font-size: 9px; font-weight: 800;
    background: linear-gradient(90deg,#ff4d8d,#b0a3ff); color: #fff;
    padding: 1px 6px; border-radius: 4px; margin-left: 4px; vertical-align: middle;
}
.sidebar-footer { border-top: 1px solid var(--border); padding: 12px; flex-shrink: 0; }
.user-chip {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: 12px; transition: background 0.2s; cursor: pointer; width: 100%;
}
.user-chip:hover { background: var(--bg-hover); }
.user-chip.guest { border: 1px dashed var(--border-strong); }
.user-avatar-mini {
    width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
    flex-shrink: 0; border: 1px solid var(--border);
}
.user-avatar-mini.fallback {
    background: linear-gradient(135deg, #ff4d8d, #b0a3ff);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 13px;
}
.user-info-mini { flex: 1; min-width: 0; }
.user-name-mini {
    font-size: 13px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center;
}
.user-sub-mini {
    font-size: 11px; color: var(--text-tertiary);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* ============ MAIN ============ */
.main { flex:1; display:flex; flex-direction:column; min-width:0; position:relative; }
.chat-header {
    display:flex; align-items:center; gap:12px; padding:12px 20px;
    border-bottom:1px solid var(--border);
    background:rgba(1,1,1,0.85); backdrop-filter:blur(12px);
    z-index:10; flex-shrink:0;
}
.back-btn, .icon-btn {
    width:36px; height:36px; border-radius:50%;
    transition:background 0.2s; flex-shrink:0;
}
.back-btn:hover, .icon-btn:hover { background:var(--bg-hover); }
.back-btn svg, .icon-btn svg { width:18px; height:18px; stroke-width:2; }
.icon-btn { color: var(--text-secondary); }
.char-avatar {
    width:40px; height:40px; border-radius:50%; object-fit:cover;
    border:1px solid var(--border-strong);
}
.char-info { flex:1; min-width:0; }
.char-name {
    font-size:15px; font-weight:600;
    display:flex; align-items:center; gap:8px; flex-wrap:wrap;
}
.char-sub {
    font-size:12px; color:var(--text-secondary);
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* ============ CHAT ============ */
.messages {
    flex:1; overflow-y:auto; padding:24px 20px;
    display:flex; flex-direction:column; gap:16px;
}
.messages-inner {
    max-width:780px; margin:0 auto; width:100%;
    display:flex; flex-direction:column; gap:16px;
}
.msg {
    display:flex; gap:12px; animation:fadeIn 0.4s ease;
    padding:8px; border-radius:10px; transition:background 0.15s;
}
@keyframes fadeIn {
    from { opacity:0; transform:translateY(8px); }
    to { opacity:1; transform:translateY(0); }
}
.msg:hover { background: rgba(255,255,255,0.02); }
.msg-avatar {
    width:36px; height:36px; border-radius:50%; object-fit:cover;
    flex-shrink:0; border:1px solid var(--border);
}
.msg-avatar.user-avatar {
    background:linear-gradient(135deg, #b0a3ff, #ff4d8d);
    display:flex; align-items:center; justify-content:center;
    font-weight:700; font-size:13px; color:#fff;
}
.msg-body { flex:1; min-width:0; padding-top:2px; }
.msg-name { font-size:13px; font-weight:600; margin-bottom:4px; }
.msg-content {
    font-size:15px; line-height:1.65;
    white-space:pre-wrap; word-wrap:break-word;
}
.msg-content em { color:#c4b5fd; font-style:italic; }
.typing-indicator { display:inline-flex; gap:4px; align-items:center; padding:4px 0; }
.typing-indicator span {
    width:6px; height:6px; border-radius:50%; background:var(--text-secondary);
    animation:bounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay:0.2s; }
.typing-indicator span:nth-child(3) { animation-delay:0.4s; }
@keyframes bounce {
    0%,80%,100% { transform:scale(0.7); opacity:0.5; }
    40% { transform:scale(1); opacity:1; }
}
.input-area {
    padding:16px 20px 20px;
    background:linear-gradient(to top, var(--bg-base) 60%, transparent);
    flex-shrink:0;
}
.input-wrapper {
    max-width:780px; margin:0 auto; background:var(--bg-input);
    border:1px solid var(--border); border-radius:24px;
    padding:8px 8px 8px 20px;
    display:flex; align-items:flex-end; gap:8px;
    transition:border-color 0.2s;
}
.input-wrapper:focus-within { border-color:var(--border-strong); }
.input-wrapper textarea {
    flex:1; background:transparent; border:none; outline:none;
    color:var(--text-primary); font-size:15px; line-height:1.5;
    padding:10px 0; max-height:160px; min-height:24px; resize:none;
}
.input-wrapper textarea::placeholder { color:var(--text-tertiary); }
.send-btn {
    width:40px; height:40px; border-radius:50%;
    background:var(--brand); color:#000; flex-shrink:0;
    transition:transform 0.2s;
}
.send-btn:hover:not(:disabled) { transform:scale(1.05); }
.send-btn:disabled { opacity:0.3; cursor:not-allowed; }
.send-btn svg { width:18px; height:18px; }
.input-footer {
    max-width:780px; margin:8px auto 0; text-align:center;
    font-size:11px; color:var(--text-tertiary);
    display:flex; align-items:center; justify-content:center; gap:6px;
}
.input-footer svg { width:12px; height:12px; }
.input-actions-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--bg-hover); color: var(--text-secondary);
    flex-shrink: 0; transition: all 0.2s;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
}
.input-actions-btn:hover {
    background: var(--bg-card); color: var(--text-primary);
    border-color: var(--border-strong);
}
.input-actions-btn svg { width: 18px; height: 18px; }

/* ============ BUTTONS ============ */
.btn {
    padding:12px 24px; border-radius:9999px; font-size:15px; font-weight:600;
    transition:all 0.2s; cursor:pointer;
    display:inline-flex; align-items:center; gap:8px; justify-content:center;
}
.btn svg { width:16px; height:16px; }
.btn-primary { background:#fff; color:#000; }
.btn-primary:hover { transform:scale(1.03); }
.btn-secondary {
    background:var(--bg-card); border:1px solid var(--border); color:var(--text-primary);
}
.btn-secondary:hover { background:var(--bg-hover); border-color:var(--border-strong); }
.btn:disabled { opacity:0.4; cursor:not-allowed; }

/* ============ FORMS ============ */
.form-container { max-width:640px; margin:0 auto; padding:32px 20px 60px; width:100%; }
.form-header { margin-bottom:32px; }
.form-title { font-size:28px; font-weight:800; margin-bottom:8px; }
.form-subtitle { font-size:15px; color:var(--text-secondary); line-height:1.6; }
.form-group { margin-bottom:20px; }
.form-label {
    display:block; font-size:13px; font-weight:600; color:var(--text-secondary);
    margin-bottom:8px; text-transform:uppercase; letter-spacing:0.5px;
}
.form-label .req { color:var(--accent); margin-left:3px; }
.form-hint { font-size:12px; color:var(--text-tertiary); margin-top:6px; line-height:1.5; }
.form-input, .form-textarea, .form-select {
    width:100%; background:var(--bg-input); border:1px solid var(--border);
    border-radius:12px; padding:14px 16px; color:var(--text-primary);
    font-size:15px; outline:none; transition:border-color 0.2s; font-family: inherit;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color:var(--accent); }
.form-textarea { min-height:100px; resize:vertical; line-height:1.6; }
.form-select { cursor:pointer; appearance:none; padding-right:40px; }
.form-select option { background:#1a1a1a; color:#fff; }
.avatar-upload { display:flex; flex-direction:column; align-items:center; gap:16px; }
.avatar-preview {
    width:140px; height:140px; border-radius:50%;
    background:var(--bg-card); border:2px dashed var(--border-strong);
    display:flex; align-items:center; justify-content:center;
    cursor:pointer; overflow:hidden; transition:all 0.2s;
}
.avatar-preview:hover { border-color:var(--accent); background:rgba(255,77,141,0.05); }
.avatar-preview img { width:100%; height:100%; object-fit:cover; }
.avatar-preview .placeholder {
    display:flex; flex-direction:column; align-items:center; gap:8px;
    color:var(--text-tertiary);
}
.avatar-preview .placeholder svg { width:40px; height:40px; stroke-width:1.5; }
.avatar-preview .placeholder span { font-size:12px; }
input[type=file] { display:none; }
.tags-input {
    display:flex; flex-wrap:wrap; gap:8px;
    padding:10px 12px; background:var(--bg-input);
    border:1px solid var(--border); border-radius:12px;
    min-height:52px; align-items:center;
}
.tags-input input {
    flex:1; min-width:100px; background:transparent;
    border:none; outline:none; color:var(--text-primary); padding:6px 0;
}
.tag-chip {
    display:inline-flex; align-items:center; gap:6px;
    padding:5px 10px; background:rgba(255,77,141,0.15);
    color:var(--accent); border-radius:9999px; font-size:13px;
}
.tag-chip button { color:var(--accent); padding:0; }
.tag-chip button svg { width:12px; height:12px; }
.slider-container { display:flex; align-items:center; gap:16px; }
.slider-container input[type=range] {
    flex:1; -webkit-appearance:none; appearance:none;
    height:6px; border-radius:3px; background:var(--bg-hover); outline:none;
}
.slider-container input[type=range]::-webkit-slider-thumb {
    -webkit-appearance:none; appearance:none;
    width:20px; height:20px; border-radius:50%;
    background:var(--accent); cursor:pointer;
}
.slider-value {
    min-width:48px; text-align:center; font-weight:600;
    color:var(--accent); background:rgba(255,77,141,0.1);
    padding:4px 8px; border-radius:6px; font-size:13px;
}

/* ============ PAGE ============ */
.page-container { max-width:1100px; margin:0 auto; padding:32px 24px 60px; width:100%; }
.page-title { font-size:28px; font-weight:800; }
.page-subtitle { color:var(--text-secondary); font-size:15px; margin-top:4px; }

/* ============ SEARCH ============ */
.search-bar { position:relative; max-width:520px; width:100%; margin:0 auto 24px; }
.search-bar input {
    width:100%; background:var(--bg-input); border:1px solid var(--border);
    border-radius:9999px; padding:12px 44px 12px 44px;
    color:var(--text-primary); font-size:14px; outline:none;
}
.search-bar input:focus { border-color:var(--border-strong); }
.search-bar .search-icon {
    position:absolute; left:16px; top:50%; transform:translateY(-50%);
    color:var(--text-tertiary); pointer-events:none;
    display:flex; align-items:center;
}
.search-bar .search-icon svg { width:18px; height:18px; }
.search-bar .clear-btn {
    position:absolute; right:10px; top:50%; transform:translateY(-50%);
    width:28px; height:28px; border-radius:50%; color:var(--text-tertiary); display:none;
}
.search-bar.has-value .clear-btn { display:inline-flex; }
.search-bar .clear-btn svg { width:14px; height:14px; }

/* ============ BANNER ============ */
.banner {
    position: relative; max-width: 1100px; margin: 0 auto 24px;
    border-radius: 16px; overflow: hidden;
    border: 1px solid var(--border); background: var(--bg-card); line-height: 0;
}
.banner img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: cover; }
.banner a { display: block; line-height: 0; }

/* ============ BOT GRID ============ */
.bot-grid { display:grid; gap:16px; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); }
.bot-card {
    background:var(--bg-card); border:1px solid var(--border);
    border-radius:16px; overflow:hidden; transition:all 0.2s;
    cursor:pointer; display:flex; flex-direction:column;
}
.bot-card:hover { border-color:var(--border-strong); transform:translateY(-2px); }
.bot-card-img { width:100%; aspect-ratio:1; object-fit:cover; background:var(--bg-hover); }
/* Wrapper gambar untuk badge */
.bot-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--bg-hover);
}

/* Badge statistik di kartu karakter */
.bot-card-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
}

.bot-card-badge span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.bot-card-badge svg {
    width: 11px;
    height: 11px;
    stroke-width: 2.5;
}
.bot-card-body { padding:14px; }
.bot-card-name {
    font-size:16px; font-weight:700; margin-bottom:6px;
    display:flex; align-items:center; justify-content:space-between; gap:8px;
}
.bot-card-desc {
    font-size:13px; color:var(--text-secondary); line-height:1.5;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
    overflow:hidden; margin-bottom:10px;
}
.bot-card-tags { display:flex; flex-wrap:wrap; gap:6px; }
.bot-card-tag {
    font-size:11px; padding:3px 8px; background:var(--bg-hover);
    border-radius:9999px; color:var(--text-secondary);
}

/* ============ DROPDOWN ============ */
.menu-wrap { position:relative; }
.dropdown-menu {
    position:absolute; top:calc(100% + 6px); right:0;
    background:var(--bg-card); border:1px solid var(--border-strong);
    border-radius:12px; padding:6px; min-width:240px;
    box-shadow:0 12px 32px rgba(0,0,0,0.5); z-index:50; display:none;
}
.dropdown-menu.open { display:block; }
.dropdown-item {
    display:flex; align-items:center; gap:10px; width:100%;
    padding:10px 12px; border-radius:8px; font-size:14px;
    color:var(--text-primary); text-align:left; transition:background 0.15s;
}
.dropdown-item:hover { background:var(--bg-hover); }
.dropdown-item svg { width:16px; height:16px; color:var(--text-secondary); flex-shrink:0; }
.dropdown-item.danger { color:#ff6b6b; }
.dropdown-item.danger svg { color:#ff6b6b; }
.dropdown-divider { height:1px; background:var(--border); margin:4px 0; }

/* ============ TOAST ============ */
.toast-container {
    position:fixed; top:20px; right:20px; z-index:2000;
    display:flex; flex-direction:column; gap:8px;
}
.toast {
    background:var(--bg-card); border:1px solid var(--border);
    border-radius:12px; padding:12px 16px; font-size:14px;
    box-shadow:0 4px 20px rgba(0,0,0,0.4);
    animation:slideIn 0.3s ease; max-width:320px;
    display:flex; align-items:center; gap:10px;
}
.toast svg { width:18px; height:18px; flex-shrink:0; }
.toast.error { border-color:rgba(255,77,77,0.4); }
.toast.error svg { color:#ff4d4d; }
.toast.success { border-color:rgba(77,255,140,0.4); }
.toast.success svg { color:var(--success); }
@keyframes slideIn {
    from { transform:translateX(120%); }
    to { transform:translateX(0); }
}

/* ============ SPINNER ============ */
.spinner {
    width:18px; height:18px; border:2px solid rgba(255,255,255,0.2);
    border-top-color:#fff; border-radius:50%;
    animation:spin 0.8s linear infinite; display:inline-block;
}
@keyframes spin { to { transform:rotate(360deg); } }

/* ============ MODAL ============ */
.modal-overlay {
    position:fixed; inset:0; background:rgba(0,0,0,0.7);
    backdrop-filter:blur(4px); z-index:1500; display:none;
    align-items:center; justify-content:center; padding:20px;
}
.modal-overlay.open { display:flex; }
.modal {
    background:var(--bg-card); border:1px solid var(--border-strong);
    border-radius:16px; width:100%; max-width:520px;
    max-height:90vh; overflow-y:auto;
}
.modal-header {
    padding:18px 20px; border-bottom:1px solid var(--border);
    display:flex; align-items:center; justify-content:space-between;
}
.modal-title { font-size:17px; font-weight:700; display:flex; align-items:center; gap:8px; }
.modal-title svg { width:18px; height:18px; }
.modal-body { padding:20px; }
.modal-footer {
    padding:16px 20px; border-top:1px solid var(--border);
    display:flex; gap:10px; justify-content:flex-end;
}

/* ============ EMPTY ============ */
.empty-bots {
    text-align:center; padding:80px 20px;
    display:flex; flex-direction:column; align-items:center; gap:20px;
}
.empty-bots svg { width: 72px; height: 72px; color: var(--text-tertiary); }

/* ============ MSG ACTION ============ */
.msg-action-overlay {
    position: fixed; inset: 0; z-index: 1600;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(2px);
    display: none; align-items: center; justify-content: center;
}
.msg-action-overlay.open { display: flex; }
.msg-action-panel {
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: 16px; padding: 8px; min-width: 240px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}
.msg-action-title {
    font-size: 11px; color: var(--text-tertiary); padding: 8px 12px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.msg-action-btn {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 12px 14px; border-radius: 10px; font-size: 14px;
    color: var(--text-primary); text-align: left; transition: background 0.15s;
}
.msg-action-btn:hover { background: var(--bg-hover); }
.msg-action-btn svg { width: 16px; height: 16px; color: var(--text-secondary); }
.msg-action-btn.danger { color: #ff6b6b; }
.msg-action-btn.danger svg { color: #ff6b6b; }

/* ============ SETTINGS PANEL ============ */
.settings-panel {
    position: fixed; bottom: 100px; right: 20px; z-index: 1400;
    background: var(--bg-card); border: 1px solid var(--border-strong);
    border-radius: 16px; padding: 16px; min-width: 320px; max-width: 400px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6); display: none;
}
.settings-panel.open { display: block; }
.settings-panel h4 {
    font-size: 14px; font-weight: 700; margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.settings-panel h4 svg { width: 16px; height: 16px; }
.settings-row { margin-bottom: 12px; }
.settings-row label {
    display: block; font-size: 11px; color: var(--text-tertiary);
    text-transform: uppercase; margin-bottom: 6px; letter-spacing: 0.5px;
}
.settings-row select {
    width: 100%; padding: 10px 12px; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-primary); font-size: 13px; outline: none;
}
.settings-hint {
    font-size: 11px; color: var(--text-tertiary); margin-top: 4px;
    line-height: 1.4; display: flex; align-items: center; gap: 4px;
}
.settings-hint svg { width: 12px; height: 12px; }
.settings-actions {
    display: flex; gap: 8px; margin-top: 16px;
    padding-top: 12px; border-top: 1px solid var(--border);
}
.settings-actions button {
    flex: 1; padding: 10px; border-radius: 10px; font-size: 13px;
    font-weight: 600; border: 1px solid var(--border);
    background: var(--bg-hover); color: var(--text-primary);
    transition: all 0.15s; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.settings-actions button svg { width: 14px; height: 14px; }
.settings-actions button.primary {
    background: linear-gradient(90deg,#ff4d8d,#b0a3ff); color: #fff; border: none;
}
.settings-actions button.danger { color: #ff6b6b; border-color: rgba(255,77,77,0.3); }

/* ============ SENSOR ============ */
.sensor-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 9999px; font-size: 10px;
    font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    margin-left: 4px;
}
.sensor-badge svg { width: 11px; height: 11px; }
.sensor-badge.high { background: rgba(74,222,128,0.15); color: #4ade80; }
.sensor-badge.low { background: rgba(255,77,141,0.15); color: #ff4d8d; }

/* ============ EDIT ============ */
.edit-textarea {
    width: 100%; min-height: 100px; padding: 12px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text-primary);
    font-size: 14px; line-height: 1.6; resize: vertical;
    outline: none; font-family: inherit;
}

/* ============ ONBOARD ============ */
.onboard-wrap { max-width:600px; margin:0 auto; padding:40px 20px 60px; width:100%; }
.chip-grid { display:flex; flex-wrap:wrap; gap:8px; }
.chip {
    padding:8px 14px; border-radius:9999px;
    background:var(--bg-input); border:1px solid var(--border);
    font-size:13px; color:var(--text-secondary);
    cursor:pointer; user-select:none;
}
.chip.active {
    background:linear-gradient(90deg, rgba(255,77,141,0.2), rgba(176,163,255,0.2));
    border-color: var(--accent); color: var(--accent); font-weight:600;
}
.gender-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; }
.gender-card {
    padding:16px 12px; border-radius:14px; background:var(--bg-input);
    border:1.5px solid var(--border); text-align:center; cursor:pointer;
}
.gender-card.active { border-color: var(--accent); background: rgba(255,77,141,0.08); }
.gender-icon {
    width:32px; height:32px; margin:0 auto 6px;
    display:flex; align-items:center; justify-content:center;
    color:var(--text-secondary);
}
.gender-icon svg { width:32px; height:32px; stroke-width:1.5; }
.gender-card.active .gender-icon { color:var(--accent); }
.gender-label { font-size:13px; font-weight:600; }

/* ============ HERO ============ */
.hero {
    padding:60px 20px 40px; text-align:center;
    background:radial-gradient(ellipse at top, rgba(255,77,141,0.15), transparent 60%);
}
.hero-title {
    font-size:36px; font-weight:900;
    background:linear-gradient(90deg,#ff4d8d,#b0a3ff,#ffffff);
    -webkit-background-clip:text; -webkit-text-fill-color:transparent;
    background-clip:text; margin-bottom:12px;
}
.hero-sub { font-size:16px; color:var(--text-secondary); max-width:520px; margin:0 auto; line-height:1.6; }

/* ============ PLANS ============ */
.plans {
    display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
    gap:20px; max-width:1100px; margin:40px auto; padding:0 20px;
}
.plan-card {
    background:var(--bg-card); border:1px solid var(--border);
    border-radius:20px; padding:28px; position:relative;
    display:flex; flex-direction:column;
}
.plan-card.featured {
    border:1.5px solid transparent;
    background:linear-gradient(#141414,#141414) padding-box,
               linear-gradient(90deg,#ff4d8d,#b0a3ff) border-box;
}
.plan-card.current { border:1.5px solid var(--success); }
.plan-card.expired { border:1.5px solid #ff6b6b; opacity:0.85; }
.plan-card-badge {
    position:absolute; top:16px; right:16px; font-size:10px;
    padding:4px 10px; border-radius:9999px;
    background:linear-gradient(90deg,#ff4d8d,#b0a3ff); color:#fff; font-weight:700;
}
.plan-card-badge.current-badge { background:rgba(74,222,128,0.2); color:var(--success); }
.plan-card-badge.expired-badge { background:rgba(255,77,77,0.2); color:#ff6b6b; }
.plan-card-name { font-size:22px; font-weight:800; margin-bottom:6px; display:flex; align-items:center; gap:8px; }
.plan-card-name svg { width:20px; height:20px; }
.plan-card-price { display:flex; align-items:baseline; gap:4px; margin-bottom:8px; flex-wrap:wrap; }
.plan-card-price .amount { font-size:36px; font-weight:800; }
.plan-card-price .per { font-size:13px; color:var(--text-secondary); }
.plan-card-desc { font-size:13px; color:var(--text-secondary); margin-bottom:20px; min-height:40px; line-height:1.5; }
.plan-card-btn { margin-bottom:20px; width:100%; }
.plan-card-features {
    list-style:none; display:flex; flex-direction:column; gap:10px;
    margin-top:auto; padding-top:20px; border-top:1px solid var(--border);
}
.plan-card-features li { display:flex; align-items:flex-start; gap:8px; font-size:13px; line-height:1.5; }
.plan-card-features li svg { width:16px; height:16px; color:var(--success); flex-shrink:0; margin-top:2px; }
.memory-highlight {
    background:rgba(255,77,141,0.1); color:var(--accent);
    padding:3px 8px; border-radius:6px; font-weight:700; font-size:12px;
}
.expiry-info {
    font-size:12px; color:var(--text-tertiary); margin-bottom:12px;
    display:flex; align-items:center; gap:6px;
}
.expiry-info svg { width:13px; height:13px; }

/* ============ ADMIN ============ */
.admin-wrap { max-width:1400px; margin:0 auto; padding:24px; width:100%; }
.admin-stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:24px; }
.stat-card { background:var(--bg-card); border:1px solid var(--border); border-radius:14px; padding:16px; }
.stat-value { font-size:26px; font-weight:800; color:var(--accent); }
.stat-label { font-size:11px; color:var(--text-secondary); margin-top:4px; text-transform:uppercase; }
.admin-badge {
    display:inline-flex; align-items:center; gap:6px;
    padding:4px 12px; border-radius:9999px;
    background: linear-gradient(90deg,#ff4d8d,#b0a3ff); color: #fff;
    font-size:11px; font-weight:800;
}
.admin-badge svg { width:12px; height:12px; }
.tabs {
    display:flex; gap:4px; border-bottom:1px solid var(--border);
    margin-bottom:20px; overflow-x:auto;
}
.tab {
    padding:12px 18px; font-size:14px; font-weight:600;
    color:var(--text-secondary); border-bottom:2px solid transparent;
    transition:all 0.2s; white-space:nowrap; cursor:pointer; background:none;
    display:inline-flex; align-items:center; gap:6px;
}
.tab svg { width:14px; height:14px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-pane { display:none; }
.tab-pane.active { display:block; }
.admin-table {
    width:100%; border-collapse:collapse; background:var(--bg-card);
    border:1px solid var(--border); border-radius:14px; overflow:hidden;
}
.admin-table th, .admin-table td {
    padding:12px 14px; text-align:left; font-size:13px;
    border-bottom:1px solid var(--border); vertical-align:middle;
}
.admin-table th {
    background: rgba(255,255,255,0.02); font-weight:600;
    color:var(--text-secondary); text-transform:uppercase; font-size:11px;
}
.pill {
    display:inline-flex; align-items:center; padding:3px 10px;
    border-radius:9999px; font-size:11px; font-weight:700; gap:4px;
}
.pill svg { width:11px; height:11px; }
.pill.basic { background:rgba(156,163,175,0.15); color:#9ca3af; }
.pill.plus { background:rgba(176,163,255,0.15); color:#b0a3ff; }
.pill.ultra { background:rgba(255,234,140,0.15); color:#FFEA8C; }
.pill.expired { background:rgba(255,77,77,0.15); color:#ff6b6b; }
.pill.permanent { background:rgba(74,222,128,0.1); color:#4ade80; }
.pill.guest { background:rgba(255,255,255,0.05); color:#9ca3af; }
.pill.banned { background:rgba(255,77,77,0.2); color:#ff6b6b; }
.btn-mini {
    padding:6px 10px; font-size:12px; font-weight:600;
    border-radius:8px; border:1px solid var(--border);
    background: var(--bg-hover); color: var(--text-primary);
    cursor:pointer; display:inline-flex; align-items:center; gap:4px;
}
.btn-mini svg { width:12px; height:12px; }
.btn-mini.danger { color:#ff6b6b; border-color:rgba(255,77,77,0.3); }
.btn-mini.success { color:#4ade80; border-color:rgba(74,222,128,0.3); }
.btn-mini.primary { background: linear-gradient(90deg,#ff4d8d,#b0a3ff); color:#fff; border:none; }
.row-actions { display:flex; gap:6px; flex-wrap:wrap; }
.admin-select {
    background: var(--bg-input); border:1px solid var(--border);
    color: var(--text-primary); padding:6px 10px; border-radius:8px;
    font-size:12px; outline:none; cursor:pointer;
}
.report-card {
    background:var(--bg-card); border:1px solid var(--border);
    border-radius:12px; padding:16px; margin-bottom:12px;
}
.report-card.resolved { opacity:0.55; }
.report-head { display:flex; justify-content:space-between; gap:12px; margin-bottom:8px; flex-wrap:wrap; }
.report-reason { font-weight:700; font-size:14px; color:#ff8fb1; display:flex; align-items:center; gap:6px; }
.report-reason svg { width:14px; height:14px; }
.report-meta { font-size:11px; color:var(--text-tertiary); }
.report-details { font-size:13px; color:var(--text-secondary); line-height:1.6; margin-bottom:12px; }
.ai-panel { background:var(--bg-card); border:1px solid var(--border); border-radius:16px; padding:24px; }
.ai-status {
    display:flex; align-items:center; gap:12px; margin-bottom:20px;
    padding:16px; border-radius:12px;
}
.ai-status.ok { background:rgba(74,222,128,0.08); border:1px solid rgba(74,222,128,0.25); }
.ai-status.warn { background:rgba(255,234,140,0.08); border:1px solid rgba(255,234,140,0.25); }
.ai-status.err { background:rgba(255,77,77,0.08); border:1px solid rgba(255,77,77,0.25); }
.ai-status-icon { width:32px; height:32px; display:flex; align-items:center; justify-content:center; }
.ai-status-icon svg { width:32px; height:32px; }
.ai-info-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:12px; }
.ai-info-item {
    background:var(--bg-input); border:1px solid var(--border);
    border-radius:10px; padding:12px;
}
.ai-info-label { font-size:11px; color:var(--text-tertiary); text-transform:uppercase; margin-bottom:4px; }
.ai-info-value { font-size:13px; font-weight:600; word-break:break-all; }

/* ============ PROFILE ============ */
.profile-hero {
    position: relative; width: 100%; aspect-ratio: 16/9;
    max-height: 380px; overflow: hidden; margin-top: 0 !important; z-index: 1;
}
.profile-hero img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, var(--bg-base) 0%, transparent 60%);
}
.profile-content { max-width: 900px; margin: 0 auto; padding: 0 24px 60px; position: relative; z-index: 2; }
.profile-header-block {
    margin-top: -60px; position: relative; z-index: 2;
    display: flex; align-items: flex-end; gap: 20px;
    margin-bottom: 24px; flex-wrap: wrap;
}
.profile-avatar {
    width: 140px; height: 140px; border-radius: 20px;
    object-fit: cover; border: 4px solid var(--bg-base);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.profile-meta { flex: 1; min-width: 200px; padding-bottom: 8px; }
.profile-name { font-size: 28px; font-weight: 900; margin-bottom: 4px; }
.profile-badges { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }
.profile-tag {
    font-size: 11px; padding: 3px 10px; background: var(--bg-hover);
    border-radius: 9999px; color: var(--text-secondary);
}
.gender-pill {
    display:inline-flex; align-items:center; gap:6px;
    padding: 4px 12px; border-radius: 9999px;
    background: rgba(176,163,255,0.12); color: var(--accent-2);
    font-size: 12px; font-weight: 700;
}
.gender-pill svg { width: 14px; height: 14px; }
.section { margin-bottom: 28px; }
.section-label {
    font-size: 11px; font-weight: 700; color: var(--text-tertiary);
    text-transform: uppercase; margin-bottom: 10px;
}
.section-text { font-size: 15px; line-height: 1.7; color: var(--text-primary); white-space: pre-wrap; }
.opening-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; padding: 18px; font-size: 14px;
    line-height: 1.7; font-style: italic; white-space: pre-wrap; position: relative;
}
.opening-box::before {
    content: '"'; position: absolute; top: -8px; left: 14px;
    font-size: 40px; color: var(--accent); line-height: 1;
}
.owner-card {
    display: flex; align-items: center; gap: 10px; padding: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; font-size: 13px;
}
.owner-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    object-fit: cover; background: linear-gradient(135deg, #ff4d8d, #b0a3ff);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700;
}
.owner-avatar svg { width: 18px; height: 18px; }
.cta-bar {
    position: sticky; bottom: 0;
    background: linear-gradient(to top, var(--bg-base) 60%, transparent);
    padding: 16px 0 8px; display: flex; gap: 10px;
}

/* ============ HISTORY ============ */
.history-page { max-width: 900px; margin: 0 auto; padding: 24px; }
.history-search { position: relative; margin-bottom: 20px; }
.history-search input {
    width: 100%; padding: 14px 44px; font-size: 15px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 9999px; color: var(--text-primary); outline: none;
}
.history-search .search-icon {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--text-tertiary); display: flex; align-items: center;
}
.history-search .search-icon svg { width: 18px; height: 18px; }
.history-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px; margin-bottom: 8px;
    transition: all 0.15s; text-decoration: none; color: inherit;
}
.history-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.history-card-avatar {
    width: 48px; height: 48px; border-radius: 50%;
    object-fit: cover; border: 1px solid var(--border); flex-shrink: 0;
}
.history-card-body { flex: 1; min-width: 0; }
.history-card-title {
    font-size: 15px; font-weight: 600; margin-bottom: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-card-meta {
    font-size: 12px; color: var(--text-secondary);
    display: flex; gap: 10px; flex-wrap: wrap;
}
.history-card-bot { color: var(--accent-2); font-weight: 500; }
.history-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.history-card-btn {
    width: 32px; height: 32px; border-radius: 50%;
    color: var(--text-tertiary); transition: all 0.15s;
    display: inline-flex; align-items: center; justify-content: center;
}
.history-card-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.history-card-btn.danger:hover { background: rgba(255,77,77,0.15); color: #ff6b6b; }
.history-card-btn svg { width: 16px; height: 16px; }
.history-empty-page {
    text-align: center; padding: 80px 20px; color: var(--text-secondary);
    display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.history-empty-page > svg:first-child { width: 64px; height: 64px; color: var(--text-tertiary); }
.history-empty-page > svg { width: 48px; height: 48px; color: var(--text-tertiary); }
.history-empty-page .big-icon { width: 64px; height: 64px; color: var(--text-tertiary); }

/* ============ RESPONSIVE ============ */
@media (max-width:768px) {
    .sidebar {
        position:fixed; top:0; left:0; height:100vh; z-index:100;
        transform:translateX(-100%); transition:transform 0.3s;
    }
    .sidebar.open { transform:translateX(0); }
    .mobile-menu-btn { display:inline-flex !important; }
    .page-container, .form-container { padding:24px 16px 100px; }
    .admin-table { font-size:12px; }
    .admin-wrap { padding:16px; }
    .settings-panel { left: 10px; right: 10px; min-width: 0; }
    .profile-hero { aspect-ratio: 4/3; max-height: 280px; }
    .profile-header-block { margin-top: -40px; }
    .profile-avatar { width: 100px; height: 100px; }
    .profile-name { font-size: 22px; }
}
.mobile-menu-btn { display:none; }
/* ============ CREATOR PROFILE ============ */
.creator-card {
    display: flex;
    gap: 24px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.creator-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 100px;
    background: radial-gradient(ellipse at top left,
        rgba(255,77,141,0.15), transparent 60%),
        radial-gradient(ellipse at top right,
        rgba(176,163,255,0.12), transparent 60%);
    pointer-events: none;
}

.creator-avatar-wrap {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.creator-avatar,
.creator-avatar-fallback {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    object-fit: cover;
    border: 3px solid var(--border-strong);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.creator-avatar-fallback {
    background: linear-gradient(135deg, #ff4d8d, #b0a3ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 40px;
}

.creator-info {
    flex: 1;
    min-width: 240px;
    position: relative;
    z-index: 1;
}

.creator-name {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.creator-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.creator-meta-item {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
}

.creator-meta-label {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin-bottom: 4px;
}

.creator-meta-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.creator-meta-value.mono {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-secondary);
}

.creator-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.creator-stat {
    background: linear-gradient(135deg,
        rgba(255,77,141,0.1), rgba(176,163,255,0.1));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 18px;
    text-align: center;
    min-width: 110px;
}

.creator-stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 4px;
}

.creator-stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Badge statistik di kartu karakter */
.bot-card-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
}

.bot-card-badge span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.bot-card-badge svg {
    width: 11px;
    height: 11px;
    stroke-width: 2.5;
}

@media (max-width: 640px) {
    .creator-card {
        padding: 18px;
        gap: 16px;
    }
    .creator-avatar,
    .creator-avatar-fallback {
        width: 72px;
        height: 72px;
        border-radius: 18px;
        font-size: 28px;
    }
    .creator-name {
        font-size: 18px;
    }
    .creator-meta-grid {
        grid-template-columns: 1fr;
    }
}