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

body {
  font-family: "Segoe UI", sans-serif;
  height: 100vh;
  overflow: hidden;
}

#app {
  height: 100vh;
}

.app-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #0a0a15;
  color: #e2e8f0;
}

.app-wrap.light-theme {
  background: #f0f2f5;
  color: #333;
}
.app-wrap.light-theme .dash-header {
  background: #fff;
  border-bottom-color: #ddd;
}
.app-wrap.light-theme .logo i {
  color: #6366f1;
}
.app-wrap.light-theme .view-btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: #ccc;
  color: #555;
}
.app-wrap.light-theme .view-btn.active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}
.app-wrap.light-theme .view-btn:hover {
  border-color: #6366f1;
}
.app-wrap.light-theme .shortcut-hint {
  color: #888;
}
.app-wrap.light-theme .theme-btn {
  color: #333;
  border-color: #ccc;
}
.app-wrap.light-theme .theme-btn:hover {
  border-color: #6366f1;
}
.app-wrap.light-theme .fav-cell {
  background: #fff;
  border-color: #e0e0e0;
}
.app-wrap.light-theme .fav-cell:hover {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.04);
}
.app-wrap.light-theme .fav-cell.empty {
  background: #f8f8f8;
}
.app-wrap.light-theme .fav-cell .cell-code {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}
.app-wrap.light-theme .fav-cell .cell-name {
  color: #555;
}
.app-wrap.light-theme .fav-list .list-header {
  background: #f5f5f5;
  color: #666;
}
.app-wrap.light-theme .fav-list .list-row {
  background: #fff;
  border-bottom-color: #eee;
}
.app-wrap.light-theme .fav-list .list-row:hover {
  background: #fafafa;
}
.app-wrap.light-theme .fav-list .list-row input {
  background: #f8f8f8;
  color: #333;
  border-color: #ddd;
}
.app-wrap.light-theme .fav-list .list-row input:focus {
  border-color: #6366f1;
}
.app-wrap.light-theme .fav-list .btn-save-all {
  background: #6366f1;
}
.app-wrap.light-theme .fav-list .btn-open {
  color: #6366f1;
  border-color: #ddd;
}
.app-wrap.light-theme .fav-list .btn-open:hover:not(:disabled) {
  border-color: #6366f1;
}
.app-wrap.light-theme .key-toast {
  background: rgba(99, 102, 241, 0.95);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
}
.app-wrap.light-theme .modal-overlay .modal-panel {
  background: #fff;
}
.app-wrap.light-theme .modal-overlay .modal-head {
  border-bottom-color: #eee;
  color: #333;
}
.app-wrap.light-theme .modal-overlay .modal-head h3 i {
  color: #6366f1;
}
.app-wrap.light-theme .modal-overlay .modal-close:hover {
  color: #333;
}
.app-wrap.light-theme .modal-overlay .modal-body label {
  color: #666;
}
.app-wrap.light-theme .modal-overlay .modal-body input {
  background: #f8f8f8;
  color: #333;
  border-color: #ddd;
}
.app-wrap.light-theme .modal-overlay .modal-body input:focus {
  border-color: #6366f1;
}
.app-wrap.light-theme .modal-overlay .modal-foot {
  border-top-color: #eee;
}
.app-wrap.light-theme .modal-overlay .modal-foot .btn-cancel {
  background: #f0f0f0;
  color: #333;
}
.app-wrap.light-theme .modal-overlay .modal-foot .btn-cancel:hover {
  background: #e5e5e5;
}
.app-wrap.light-theme .save-toast {
  background: rgba(34, 197, 94, 0.95);
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  padding: 0 16px;
  background: #1a1a2e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.logo {
  font-size: 1.1rem;
  font-weight: bold;
  white-space: nowrap;
}
.logo i {
  color: #a855f7;
  margin-right: 8px;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-btn {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.view-btn.active {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}
.view-btn:hover {
  border-color: #a855f7;
}

.shortcut-hint {
  font-size: 0.75rem;
  color: #64748b;
  margin-left: 12px;
}
.shortcut-hint i {
  margin-right: 4px;
}

.theme-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e2e8f0;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1rem;
}
.theme-btn:hover {
  border-color: #a855f7;
}

.fav-grid {
  display: grid;
  flex: 1;
  gap: 4px;
  padding: 4px;
  min-height: 0;
}

.fav-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.fav-cell:hover {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.08);
  transform: scale(1.02);
}
.fav-cell.empty {
  opacity: 0.5;
}
.fav-cell.empty:hover {
  opacity: 0.8;
}
.fav-cell .cell-code {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}
.fav-cell .cell-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fav-cell .cell-icon img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}
.fav-cell .cell-icon.cell-icon-empty {
  color: #64748b;
  font-size: 1rem;
}
.fav-cell .cell-name {
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: center;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fav-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

.list-header {
  display: grid;
  grid-template-columns: 60px 50px 1fr 2fr 60px;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px 8px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
}

.list-row {
  display: grid;
  grid-template-columns: 60px 50px 1fr 2fr 60px;
  gap: 8px;
  padding: 8px 12px;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.list-row:hover {
  background: rgba(255, 255, 255, 0.04);
}
.list-row .col-code {
  font-size: 0.8rem;
  font-weight: 600;
  color: #a855f7;
}
.list-row .col-icon img {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}
.list-row input {
  width: 100%;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #e2e8f0;
  font-size: 0.85rem;
  outline: none;
}
.list-row input:focus {
  border-color: #a855f7;
}

.btn-save-all {
  padding: 4px 10px;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-save-all:hover {
  opacity: 0.9;
}

.btn-open {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #a855f7;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.btn-open:disabled {
  opacity: 0.3;
  cursor: default;
}
.btn-open:hover:not(:disabled) {
  border-color: #a855f7;
}

.key-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(168, 85, 247, 0.95);
  color: #fff;
  border-radius: 12px;
  min-width: 200px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  box-shadow: 0 8px 32px rgba(168, 85, 247, 0.3);
  z-index: 200;
}
.key-toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.key-toast .toast-header {
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.key-toast .toast-header i {
  margin-right: 6px;
}
.key-toast .toast-body {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
}
.key-toast .key-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay .modal-panel {
  background: #1a1a2e;
  border-radius: 12px;
  width: 400px;
  max-width: 90vw;
  overflow: hidden;
}
.modal-overlay .modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-overlay .modal-head h3 {
  font-size: 1rem;
}
.modal-overlay .modal-head h3 i {
  margin-right: 8px;
  color: #a855f7;
}
.modal-overlay .modal-close {
  background: none;
  border: none;
  color: #64748b;
  font-size: 1.1rem;
  cursor: pointer;
}
.modal-overlay .modal-close:hover {
  color: #e2e8f0;
}
.modal-overlay .modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-overlay .modal-body label {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
}
.modal-overlay .modal-body input {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 0.9rem;
  outline: none;
}
.modal-overlay .modal-body input:focus {
  border-color: #a855f7;
}
.modal-overlay .modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.modal-overlay .btn-cancel {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 8px;
  color: #94a3b8;
  cursor: pointer;
  font-weight: 600;
}
.modal-overlay .btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
}
.modal-overlay .btn-confirm {
  padding: 8px 16px;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}
.modal-overlay .btn-confirm:hover {
  opacity: 0.9;
}

.save-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(34, 197, 94, 0.95);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 200;
}
.save-toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.save-toast i {
  margin-right: 6px;
}

@media (max-width: 768px) {
  .shortcut-hint {
    display: none;
  }
  .logo {
    font-size: 0.9rem;
  }
  .fav-grid {
    gap: 2px;
    padding: 2px;
  }
  .fav-cell {
    gap: 2px;
    border-radius: 4px;
  }
  .fav-cell .cell-code {
    font-size: 0.45rem;
    top: 2px;
    left: 2px;
    padding: 1px 3px;
  }
  .fav-cell .cell-icon {
    width: 20px;
    height: 20px;
  }
  .fav-cell .cell-icon img {
    width: 16px;
    height: 16px;
  }
  .fav-cell .cell-icon.cell-icon-empty {
    font-size: 0.7rem;
  }
  .fav-cell .cell-name {
    font-size: 0.5rem;
  }
  .list-header,
  .list-row {
    grid-template-columns: 40px 36px 1fr 1.5fr 40px;
    gap: 4px;
    font-size: 0.75rem;
    padding: 6px 8px;
  }
}
