/* ═══ CACHE PAGE ═══ */
.cache-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.ck { background: #fff; border: 1px solid #e8e6df; border-radius: 12px; padding: 18px 16px; text-align: center; }
.ck-val { font-size: 26px; font-weight: 700; line-height: 1.1; }
.ck-label { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; }

/* Tabs */
.cache-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: #f0eeea; padding: 4px; border-radius: 10px; width: fit-content; }
.cache-tab { padding: 8px 20px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; background: transparent; color: #888; transition: all .15s; }
.cache-tab.active { background: #fff; color: #333; box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* Category cards */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.cat-card { background: #fff; border: 1px solid #e8e6df; border-radius: 10px; padding: 16px; }
.cat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #f0eeea; }
.cat-name { font-weight: 600; font-size: 14px; color: #333; }
.cat-badge { padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; color: #fff; }
.cat-keys-list { }
.ck-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; font-size: 12px; border-bottom: 1px dashed #f0eeea; cursor: pointer; transition: background .1s; border-radius: 4px; padding: 5px 6px; margin: 0 -6px; }
.ck-row:hover { background: #faf8f5; }
.ck-row:last-child { border-bottom: none; }
.ck-key { font-family: 'Fira Code', 'Consolas', monospace; color: #555; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ck-ttl { font-size: 11px; color: #aaa; white-space: nowrap; }
.ck-ttl.hot { color: #ef4444; }
.cat-clear { margin-top: 10px; padding: 5px 12px; border: 1px solid #e8e6df; border-radius: 6px; background: #fff; font-size: 11px; cursor: pointer; color: #888; transition: all .15s; }
.cat-clear:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
.cat-more { display: inline-block; margin-top: 6px; padding: 4px 12px; border: 1px solid #C9A96E; border-radius: 6px; background: #fff; font-size: 11px; cursor: pointer; color: #C9A96E; font-weight: 500; transition: all .15s; }
.cat-more:hover { background: #C9A96E; color: #fff; }
.cat-keys-list.expanded { max-height: 320px; overflow-y: auto; }

/* Keys table */
.keys-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.keys-toolbar input { padding: 8px 14px; border-radius: 8px; border: 1px solid #e8e6df; font-size: 13px; min-width: 200px; outline: none; background: #fff; }
.keys-toolbar input:focus { border-color: #C9A96E; box-shadow: 0 0 0 3px rgba(201,169,110,.12); }
.kt-btn { padding: 8px 16px; border-radius: 8px; border: 1px solid #e8e6df; background: #fff; font-size: 13px; cursor: pointer; font-weight: 500; transition: all .15s; }
.kt-btn:hover { background: #faf8f5; }
.kt-btn.primary { background: #C9A96E; color: #fff; border-color: #C9A96E; }
.kt-btn.primary:hover { background: #b8944f; }
.kt-btn.danger { color: #dc2626; border-color: #fca5a5; }
.kt-btn.danger:hover { background: #fef2f2; }

.keys-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.keys-tbl th { background: #faf8f5; text-align: left; padding: 10px 12px; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #888; border-bottom: 2px solid #e8e6df; }
.keys-tbl td { padding: 8px 12px; border-bottom: 1px solid #f0eeea; }
.keys-tbl tr { cursor: pointer; transition: background .1s; }
.keys-tbl tr:hover td { background: #fdfcfa; }
.key-mono { font-family: 'Fira Code', 'Consolas', monospace; font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.type-pill { display: inline-block; padding: 1px 8px; border-radius: 8px; font-size: 10px; font-weight: 600; }
.type-string { background: #dbeafe; color: #1d4ed8; }
.type-hash { background: #fef3c7; color: #92400e; }
.type-list { background: #dcfce7; color: #166534; }
.type-set { background: #f3e8ff; color: #7c3aed; }

/* Detail modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 999; display: none; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 14px; width: min(700px, 90vw); max-height: 80vh; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e8e6df; }
.modal-title { font-weight: 600; font-size: 14px; }
.modal-close { width: 28px; height: 28px; border: none; background: #f0eeea; border-radius: 6px; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #e8e6df; }
.modal-meta { display: flex; gap: 16px; padding: 12px 20px; background: #faf8f5; font-size: 12px; color: #888; border-bottom: 1px solid #f0eeea; }
.modal-meta b { color: #555; }
.modal-body { padding: 16px 20px; max-height: 55vh; overflow-y: auto; }
.modal-body pre { background: #1e1e2e; color: #cdd6f4; padding: 16px; border-radius: 10px; font-size: 12px; font-family: 'Fira Code', 'Consolas', monospace; overflow-x: auto; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }

/* Toast */
.toast { position: fixed; top: 20px; right: 20px; padding: 12px 20px; border-radius: 10px; color: #fff; font-size: 13px; font-weight: 500; z-index: 9999; transform: translateY(-20px); opacity: 0; transition: all .3s; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }

.loading { text-align: center; padding: 40px; color: #888; }
.spinner { width: 28px; height: 28px; border: 3px solid #f0eeea; border-top-color: #C9A96E; border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 40px; color: #aaa; font-size: 14px; }